All triggers are derived from the abstract base class named 'Trigger'.
To create a custom specialized trigger, create a new script and derive from 'Trigger' class.
'Trigger' class has one abstract method which must be overridden and that is 'Trigger.start(...)' method.
'Trigger.start(...)' method is is the main method that starts trigger.
If 'Trigger.start(...)' is starting action ( trigger animation ) - be sure to create new 'TriggerManagement.triggerInfo' instance.
It holds information on match target, rotations and other important values used when starting trigger animation.
At the end of the method return true to notify trigger manager that action animation will start. Also, make sure that you set trigger active value to true if the trigger is started.
If a trigger is only used to do some simple actions like pick up a weapon, health or
transport to other position ( not starting trigger animation ), return false and don't create trigger info.
There are additional virtual methods that can be overridden for a more customized solution:
- 'initialize()'- initializes component.
- 'npcCondition(...)' - condition only used on NPCs.
- 'condition(...)' - condition used on all.
If 'npcCondition(...)' or 'condition(...)' return false, code will not reach 'start(...)' method but return early.
- 'get_info_text(...)' - display text method that will be shown when entering trigger collider.
- 'end(...)' - executed by event on end of trigger animation.
- 'OnMatchTargetStart(...)' - executed by event on match target start. If any procedure needs to processed at match start, put it here.
- 'Clear()'- clear references.
- 'OnMatchTargetEnd(...)' - executed by event on match target end.
- 'Exit(...)' - executes when a character leaves trigger collider.
nputs.
You can look in other specialized triggers in the project to get more pointers on how to implement.