Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorBehaviorTreeTimer Class Reference

Behavior element behavior adding timer support to behavior tree support. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorBehaviorTreeTimer:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  BehaviorTreeTimer
 Behavior tree Timer. More...
 
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...
 

Detailed Description

Behavior element behavior adding timer support to behavior tree support.

Behavior adds behavior tree actions and conditions to an ECBehaviorBehaviorTree allowing behavior trees to start and wait for multiple independent timers. This behavior can be added multiple times to an element for each ECBehaviorBehaviorTree. Each instance creates an own set of behavior tree action and conditions and timers. Hence to use more than one behavior tree use code like this in your subclass constructor:

class MyElement extends BehaviorElementClass
public func new()
var ECBehaviorBehaviorTree btree = ECBehaviorBehaviorTree.new(this)
var ECBehaviorBehaviorTree btree2 = ECBehaviorBehaviorTree.new(this, "bt2")
ECBehaviorBehaviorTreeTimer.new(this, btree)
ECBehaviorBehaviorTreeTimer.new(this, btree, "bt2")
end
end
DefaultECBehavior new(BehaviorElementClass eclass)
Create default composeable behavior with empty identifier.

The following actions are added to the behavior tree:

Action "timer.start"

Starts a timer. As parameter use "timeout" to set the seconds until the timer elapses or "timeout.lower" and "timeout.upper" to randomly select seconds between a lower and upper limit (inclusive). Optionally use parameter "timer" to select the timer. "timer" is a string identifier you can freely choose. If absent empty string is used as timer identifier. The timer is created if absent. This action immediately returns and does not require a rule identifier.

This is an example of using this action:

<action name='timer.start'>
<parameter name='timeout'>1.5</parameter>
<parameter name='timer'>myTimer</parameter>
</action>

This is an example of using this action with random timeout:

<action name='timer.start'>
<parameter name='timeout.lower'>1.5</parameter>
<parameter name='timeout.upper'>2.5</parameter>
<parameter name='timer'>myTimer</parameter>
</action>
Action "timer.stop"

Stops a timer. Optionally as parameter use "timer" to select the timer matching an identifier used in a previous action "timer.start". This action immediately returns and does not require a rule identifier.

This is an example of using this action:

<action name='timer.stop'>
<parameter name='timer'>myTimer</parameter>
</action>
Action "timer.wait"

Waits for a timer to elapse. Optionally as parameter use "timer" to select the timer matching an identifier used in a previous action "timer.start". The action keeps running until the timer elapsed. If the timer is absent the action immediately returns.

This is an example of using this action:

<action name='timer.stop' id='waiting'>
<parameter name='timer'>myTimer</parameter>
</action>
Condition "timer.running"

Determines if timer is running and has not elapsed yet. Optionally as parameter use "timer" to select the timer matching an identifier used in a previous action "timer.start".

This is an example of an action that can only run if the timer "myTimer" is running:

<action name='myAction' id='doing something'>
<parameter name='timer'>myTimer</parameter>
<condition>timer.running</condition>
</action>
Condition "timer.finished"

Determines if timer is not running or has elapsed. Optionally as parameter use "timer" to select the timer matching an identifier used in a previous action "timer.start".

This is an example of an action that can only run if the timer "myTimer" is running:

<action name='myAction' id='doing something'>
<parameter name='timer'>myTimer</parameter>
<condition>timer.finished</condition>
</action>

The documentation for this class was generated from the following file: