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

Base abstract class for AiTree nodes. More...

Inherits ScriptableObject.

Inherited by lab.AFlowNode, lab.AParameterNode< T >, lab.TaskNode, and lab.TreeNode.

Public Member Functions

abstract bool Run (AiBlackboard parameters, IList< AiTree > trees, List< ATaskScript > tasks)
 Runs this node. More...
 
abstract bool DebugRun (AiBlackboard parameters, IList< AiTree > trees, int level, int nodeIndex)
 Runs debug this node. More...
 

Detailed Description

Base abstract class for AiTree nodes.

Unity does not serialize interfaces, but it works with assets that inherits from ScriptableObjects. Every node is an asset that is part of AiBehaviour asset. Because of that, you cannot share nodes between behaviours. Node system uses Composite pattern, that means we have composites named AFlowNode and other types of nodes that are leafs in AiTree.

Member Function Documentation

abstract bool lab.ANode.DebugRun ( AiBlackboard  parameters,
IList< AiTree trees,
int  level,
int  nodeIndex 
)
pure 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.

Implemented in lab.RepeaterNode, lab.SelectorNode, lab.SequenceNode, lab.SucceederNode, lab.InverterNode, lab.TaskNode, and lab.TreeNode.

abstract bool lab.ANode.Run ( AiBlackboard  parameters,
IList< AiTree trees,
List< ATaskScript tasks 
)
pure 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 node succeed. Otherwise false.

Implemented in lab.RepeaterNode, lab.InverterNode, lab.SucceederNode, lab.SelectorNode, lab.SequenceNode, lab.TaskNode, and lab.TreeNode.


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