Drag[en]gine Script Module DragonScript
1.23
|
Behavior element behavior adding flags support to behavior tree support. More...
Classes | |
class | Instance |
Behavior instance. More... | |
Additional Inherited Members | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
void | dispose () |
Dispose of behavior. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
DefaultECBehavior | new (BehaviorElementClass eclass) |
Create default composeable behavior with empty identifier. More... | |
DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
Create default composeable behavior. More... | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior element behavior adding flags support to behavior tree support.
Behavior adds behavior tree actions and conditions to an ECBehaviorBehaviorTree allowing scripts and behavior trees to set, clear and check flags. This can be used to signal events to behavior trees that can be processed at an appropriate time. This behavior can be added multiple times to an element for each ECBehaviorBehaviorTree. Each instance creates an own set of behavior tree actions, conditions and flags. Hence to use more than one behavior tree use code like this in your subclass constructor:
The following actions are added to the behavior tree:
Set a flag. As parameter use "flag" to select the flag to set. Use optional parameter "clear" to clear flag. This action immediately returns and does not require a rule identifier.
This is an example of using this action:
This is an example of using this action to clear flag:
Checks if flag is set. Use as parameter "flag" to select the flag to check. Use as optional parameter "cleared" to check for flag to be cleared instead of set. Use the optional parameter "wait" to wait until the flag is set or cleared. If not waiting the action returns immediately with BTResult.success if the flag is set otherwise BTResult.failure . If waiting the action keeps running until the flags becomes set or cleared then returns BTResult.success . A flag that has not been used so far is in cleared state. Use the optional parameter "reset" to toggle the flag if condition is finished. Hence if "reset" is used and the flag is set it is reset. This can be used for waiting and not waiting.
This is an example of using this action to check if a flag is set right now:
This is an example of using this action to check if a flag is cleared right now:
This is an example of using this action waiting until the flag is set:
This is an example of using this action waiting until the flag is set and then clear it:
Determines if flag is set. Use as parameter "flag" to select the flag to check. Use optional parameter "flags.cleared" to check if the flag is cleared instead of set.
This is an example of an action that can only run if the flag "arrived at target" is set:
This is an example of an action that can only run if the flag "arrived at target" is cleared: