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

Behaviour tree with ai logic. More...

Public Member Functions

bool AddNode (ANode node)
 Adds new node to this AiTree. More...
 
bool RemoveNode (ANode node)
 Removes node from this AiTree. Also removes all connections between other nodes, so it doesn't have to be done manually. More...
 
bool ConnectNodes (AFlowNode from, ANode to)
 Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops. More...
 
bool Run (AiBlackboard parameters, IList< AiTree > trees, List< ATaskScript > tasks)
 Runs this tree behaviour. More...
 
bool DebugRun (AiBlackboard parameters, IList< AiTree > trees, int level)
 Runs debug this tree behaviour. More...
 

Properties

ANode Root [get, set]
 Sets/Gets root node for current AiTree. Only flow nodes can be root nodes. More...
 
IList< ANodeNodes [get]
 Gets readonly list of all nodes assigned to this AiTree. More...
 

Detailed Description

Behaviour tree with ai logic.

Single ai tree that can be run.

Member Function Documentation

bool lab.AiTree.AddNode ( ANode  node)

Adds new node to this AiTree.

Parameters
nodeA node to add to this AiTree.
Returns
True if adding node was succeed. Otherwise false.
bool lab.AiTree.ConnectNodes ( AFlowNode  from,
ANode  to 
)

Creates connection between one node to another. The connection is one one-way and tries to prevent circular to prevent infinity loops.

Parameters
fromA node that is higher in hierarchy.
toA node that is lower in hierarchy.
Returns
True if connection succeed. Otherwise false.
bool lab.AiTree.DebugRun ( AiBlackboard  parameters,
IList< AiTree trees,
int  level 
)

Runs debug this tree behaviour.

Parameters
parametersAiBlackboard with global parameters.
treesReadonly list with all ai trees.
levelLevel of how deep we are in this AiTree.
Returns
True if debug run succeed. Otherwise false.
bool lab.AiTree.RemoveNode ( ANode  node)

Removes node from this AiTree. Also removes all connections between other nodes, so it doesn't have to be done manually.

Parameters
nodeA node to remove from this AiTree.
Returns
True if removing node was succeed. Otherwise false.
bool lab.AiTree.Run ( AiBlackboard  parameters,
IList< AiTree trees,
List< ATaskScript tasks 
)

Runs this tree behaviour.

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

Property Documentation

IList<ANode> lab.AiTree.Nodes
get

Gets readonly list of all nodes assigned to this AiTree.

ANode lab.AiTree.Root
getset

Sets/Gets root node for current AiTree. Only flow nodes can be root nodes.


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