Behavior
Behavior
Base class of behavior tree implementation
Kind: global class
See
- "The Behavior Tree Starter Kit" by Alex J. Champandard and Philip Dunstan
- https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)
- Behavior
- instance
- .context :
CTX
|null
- .onInitialized :
Signal.<this, CTX>
- .onFinalized :
Signal.<this>
- .isBehavior :
boolean
- .tick(timeDelta) ⇒
BehaviorStatus
- .initialize([context])
- .finalize()
- .context :
- static
- .typeName :
string
- .typeName :
- instance
behavior.context : CTX
| null
Any internal state used by the behavior This provides a way to interact with the outside as well as to pass data between themselves
Kind: instance property of Behavior
behavior.onInitialized : Signal.<this, CTX>
Dispatched after initialization is complete
Kind: instance property of Behavior
Read only: true
behavior.onFinalized : Signal.<this>
Dispatched after finalization is complete
Kind: instance property of Behavior
Read only: true
behavior.isBehavior : boolean
Useful for type checking
Kind: instance property of Behavior
Read only: true
behavior.tick(timeDelta) ⇒ BehaviorStatus
Main update function. Every behavior executes some logic, some behaviors are long-running and some are instantaneous
Kind: instance method of Behavior
Returns: BehaviorStatus
- signals status of the behavior, "success" or "failure" are used to signal completion of the behavior
Param | Type | Description |
---|---|---|
timeDelta | number | time step in seconds |
behavior.initialize([context])
Called before behavior gets executed via #tick for the first time Used to prepare the behavior for execution You can think of it as "start"
Kind: instance method of Behavior
Param | Type |
---|---|
[context] | CTX |
behavior.finalize()
Called when behavior is finished, or interrupted Used to clean up any resources You can think of it as "stop"
Kind: instance method of Behavior
Behavior.typeName : string
Useful for type checking
Kind: static property of Behavior
Read only: true