|
Drag[en]gine Script Module DragonScript 1.35
|
Behavior element behavior adding timer support to behavior trees and state machines. More...
Classes | |
| class | Factory |
| Behavior factory. More... | |
| class | Instance |
| Behavior instance. More... | |
| class | TrackedTimer |
| Timer. More... | |
Additional Inherited Members | |
| Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
| void | assignInstanceIndex (int instanceIndex) |
| Assign instance index. | |
| void | dispose () |
| Dispose of behavior. | |
| String | getBehaviorID () |
| Unique identifier of behavior. | |
| String | getID () |
| Identifier. | |
| int | getInstanceIndex () |
| Instance index. | |
| void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
| Load instance data of another behavior. | |
| bool | supportsBehaviorID (String identifier) |
| Behavior supports loading instance data of another behavior. | |
| Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
| ECBehaviorInstance | createInstance (BehaviorElement element) |
| Create Behavior instance. | |
| Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
| DefaultECBehavior | new (BehaviorElementClass eclass) |
| Create default composeable behavior with empty identifier. | |
| DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
| Create default composeable behavior. | |
| void | setBehaviorID (String identifier) |
| Set behavior identifier. | |
| void | useClassNameAsBehaviorID () |
| Set behavior identifier to "<class-name>:<identifier>". | |
| void | useFullyQualifiedClassNameAsBehaviorID () |
| Set behavior identifier to "<fully-qualified-class-name>:<identifier>". | |
Behavior element behavior adding timer support to behavior trees and state machines.
Behavior adds actions, conditions and events allowing behavior trees and state machines to start, stop and wait for multiple independent timers.
This behavior can be added only once to an element class.
The following actions are added:
Update timer. The following parameters are supported:
| Parameter | Value | Description |
|---|---|---|
| start | string | Start named timer. |
| timeout | 0 or larger | Seconds until the timer elapses. |
| timeout.lower | 0 or larger | Minimum seconds of random timeout. |
| timeout.upper | 0 or larger | Maximum seconds of random timeout. |
| stop | string | Stop named timer. |
This is an example of starting a timer:
This is an example of starting a timer using random timeout:
This is an example of stopping a timer:
Check for timer condition. Not existing timers are considered stopped. The following parameters are supported:
| Parameter | Value | Description |
|---|---|---|
| timer | string | Name of the timer to check. |
| running | true,false | Timer is running. |
| remaining.less | 0 or larger | Remaining seconds is less than value. |
| remaining.greater | 0 or larger | Remaining seconds is greater than value. |
| wait | If present action returns BTResult.running instead of BTResult.failed. |
This is an example of checking if a timer is running:
Check for timer condition. Not existing timers are considered stopped. The following parameters are supported:
| Parameter | Value | Description |
|---|---|---|
| timers.timer | string | Name of the timer to check. |
| timers.running | true,false | Timer is running. |
| timers.remaining.less | 0 or larger | Remaining seconds is less than value. |
| timers.remaining.greater | 0 or larger | Remaining seconds is greater than value. |
This is an example of an action that can only run if the timer "myTimer" is running:
Send to state machines if timer has elapsed. The name of the timer that has elapsed is appended to the event name.
This is an example of an transition that can only run if the timer "myTimer" has elapsed: