Behavior
Description:
A behavior tree framework for creating game AI structures.
Seq
Type: Function.
Description:
Creates a new sequence node that executes an array of child nodes in order.
Signature:
Seq: function(nodes: {Leaf}): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
nodes | {Leaf} | An array of child nodes. |
Returns:
Return Type | Description |
---|---|
Leaf | A new sequence node. |
Sel
Type: Function.
Description:
Creates a new selector node that selects and executes one of its child nodes that will succeed.
Signature:
Sel: function(nodes: {Leaf}): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
nodes | {Leaf} | An array of child nodes. |
Returns:
Return Type | Description |
---|---|
Leaf | A new selector node. |
Con
Type: Function.
Description:
Creates a new condition node that executes a check handler function when executed.
Signature:
Con: function(name: string, check: function(board: Blackboard): boolean): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the condition. |
check | function | A function that takes a blackboard object and returns a boolean value. |
Returns:
Return Type | Description |
---|---|
Leaf | A new condition node. |
Act
Type: Function.
Description:
Creates a new action node that executes an action when executed. This node will block the execution until the action finishes.
Signature:
Act: function(actionName: string): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
actionName | string | The name of the action to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new action node. |
Command
Type: Function.
Description:
Creates a new command node that executes a command when executed. This node will return right after the action starts.
Signature:
Command: function(actionName: string): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
actionName | string | The name of the command to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new command node. |
Wait
Type: Function.
Description:
Creates a new wait node that waits for a specified duration when executed.
Signature:
Wait: function(duration: number): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
duration | number | The duration to wait in seconds. |
Returns:
Return Type | Description |
---|---|
Leaf | A new wait node. |
Countdown
Type: Function.
Description:
Creates a new countdown node that executes a child node continuously until a timer runs out.
Signature:
Countdown: function(time: number, node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
time | number | The time limit in seconds. |
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new countdown node. |
Timeout
Type: Function.
Description:
Creates a new timeout node that executes a child node until a timer runs out.
Signature:
Timeout: function(time: number, node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
time | number | The time limit in seconds. |
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new timeout node. |
Repeat
Type: Function.
Description:
Creates a new repeat node that executes a child node a specified number of times.
Signature:
Repeat: function(times: integer, node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
times | integer | The number of times to execute the child node. |
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new repeat node. |
Repeat
Type: Function.
Description:
Creates a new repeat node that executes a child node repeatedly.
Signature:
Repeat: function(node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new repeat node. |
Retry
Type: Function.
Description:
Creates a new retry node that executes a child node repeatedly until it succeeds or a maximum number of retries is reached.
Signature:
Retry: function(times: integer, node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
times | integer | The maximum number of retries. |
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new retry node. |
Retry
Type: Function.
Description:
Creates a new retry node that executes a child node repeatedly until it succeeds.
Signature:
Retry: function(node: Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
node | Leaf | The child node to execute. |
Returns:
Return Type | Description |
---|---|
Leaf | A new retry node. |