lab  2016-03-28
lightweight ai behaviour trees framework for Unity 3D
lab.SelectorNode Class Reference

One of the most important flow nodes. If one of child nodes returns true after run, SelectorNode also will return true. More...

Inherits lab.AFlowNode.

Public Member Functions

override bool AddNode (ANode node)
 Adds new node as a child. More...
 
override bool RemoveNode (ANode node)
 Removes child node. More...
 
override ANode GetNode (int i)
 Gets child node at index. More...
 
override bool Run (AiBlackboard parameters, IList< AiTree > trees, List< ATaskScript > tasks)
 Runs this node. More...
 
override bool DebugRun (AiBlackboard parameters, IList< AiTree > trees, int level, int nodeIndex)
 Runs debug this node. More...
 

Properties

override int NodeCount [get]
 Gets count of child nodes. More...
 
- Properties inherited from lab.AFlowNode
abstract int NodeCount [get]
 Gets count of child nodes. More...
 

Detailed Description

One of the most important flow nodes. If one of child nodes returns true after run, SelectorNode also will return true.

SelectorNode aggregates child nodes and runs them from first to last. It stops running after first child node run result that is true, that means not all child nodes must be invoked. If all child nodes returns false, this node will also return false as a run result.

Member Function Documentation

override bool lab.SelectorNode.AddNode ( ANode  node)
virtual

Adds new node as a child.

Parameters
nodeNode to be added as child.
Returns
True if adding succeed. Otherwise false.

Implements lab.AFlowNode.

override bool lab.SelectorNode.DebugRun ( AiBlackboard  parameters,
IList< AiTree trees,
int  level,
int  nodeIndex 
)
virtual

Runs debug this node.

Parameters
parametersAiBlackboard with global parameters.
treesReadonly list with all ai trees.
levelLevel of how deep we are in this AiTree.
nodeIndexIndex of current node in parent's node. If this is root, nodeIndex is 0.
Returns
True if debug run succeed. Otherwise false.

Implements lab.ANode.

override ANode lab.SelectorNode.GetNode ( int  i)
virtual

Gets child node at index.

Parameters
iIndex of child node to get.
Returns
Child node under i index.

Implements lab.AFlowNode.

override bool lab.SelectorNode.RemoveNode ( ANode  node)
virtual

Removes child node.

Parameters
nodeChild node to remove.
Returns
True if removing succeed. Otherwise false.

Implements lab.AFlowNode.

override bool lab.SelectorNode.Run ( AiBlackboard  parameters,
IList< AiTree trees,
List< ATaskScript tasks 
)
virtual

Runs this node.

Parameters
parametersAiBlackboard with global parameters.
treesReadonly list with all ai trees.
tasksList of task scripts to bind with task nodes.
Returns
True if at least one child node succeed. Otherwise false.

Implements lab.ANode.

Property Documentation

override int lab.SelectorNode.NodeCount
get

Gets count of child nodes.


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