Skip to main content

Behavior

Behavior

Base class of behavior tree implementation

Kind: global class
See

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

ParamTypeDescription
timeDeltanumbertime 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

ParamType
[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