Public Member Functions | Public Attributes | Protected Attributes | Properties
RAIN.BehaviorTrees.BTNode Class Reference

BTNode is the abstract base class for all behavior tree nodes. BTNode is an Action, so all BTNodes conform to the standard Start(), Execute(), Stop() protocol and return ActionResults. More...

Inheritance diagram for RAIN.BehaviorTrees.BTNode:
RAIN.Action.Action RAIN.BehaviorTrees.BTActionNode RAIN.BehaviorTrees.BTConditionNode RAIN.BehaviorTrees.BTDecoratorNode RAIN.BehaviorTrees.BTIteratorNode RAIN.BehaviorTrees.BTParallelNode RAIN.BehaviorTrees.BTRandomNode RAIN.BehaviorTrees.BTSelectorNode RAIN.BehaviorTrees.BTSequencerNode RAIN.BehaviorTrees.BTTimerNode RAIN.BehaviorTrees.BTYieldNode

List of all members.

Public Member Functions

 BTNode (string nodeName)
 Standard constructor. Initializes name and child list.
virtual void GetActiveNodes (List< BTNode > nodeList)
virtual float Priority ()
 A priority value to use when sorting nodes. This allows nodes to define their relative priority to support dynamic reorganization. You must call Sort on a node to resort based on Priority.
override void SetActionContext (ActionContext context)
 SetActionContext sets the context "blackboard" on this node and on all children.
virtual void AddChild (BTNode child)
 AddChild will add a child node and then re-sort the child list.
virtual void RemoveChild (string actionName)
 RemoveChild will remove the named child node. Children are not re-sorted.
virtual void Sort ()
 Sort will reorder children based on priority, with higher priority items moved to the beginning of the list. By default Sort uses bubble sort.

Public Attributes

Expression precondition = null
 preconditions checked prior to start/execution a failed precondition will cause the node to return FAIL immediately
bool debug = false
 If debug is true a log statement will be generated everytime this node is hit.

Protected Attributes

List< BTNode_children
 A List of child nodes. Most behavior tree nodes have ordered lists of children (leaf nodes are usually exceptions.)

Properties

virtual bool IsContainer [get]

Detailed Description

BTNode is the abstract base class for all behavior tree nodes. BTNode is an Action, so all BTNodes conform to the standard Start(), Execute(), Stop() protocol and return ActionResults.


Constructor & Destructor Documentation

RAIN.BehaviorTrees.BTNode.BTNode ( string  nodeName)

Standard constructor. Initializes name and child list.

Parameters:
nodeNameName of the new node. Can be used when searching through the tree. Not guaranteed unique.

Member Function Documentation

virtual void RAIN.BehaviorTrees.BTNode.AddChild ( BTNode  child) [virtual]

AddChild will add a child node and then re-sort the child list.

Parameters:
childThe behavior tree node to add

Reimplemented in RAIN.BehaviorTrees.BTParallelNode, and RAIN.BehaviorTrees.BTDecoratorNode.

virtual float RAIN.BehaviorTrees.BTNode.Priority ( ) [virtual]

A priority value to use when sorting nodes. This allows nodes to define their relative priority to support dynamic reorganization. You must call Sort on a node to resort based on Priority.

Returns:

Reimplemented in RAIN.BehaviorTrees.BTDecoratorNode.

virtual void RAIN.BehaviorTrees.BTNode.RemoveChild ( string  actionName) [virtual]

RemoveChild will remove the named child node. Children are not re-sorted.

Parameters:
actionName

Reimplemented in RAIN.BehaviorTrees.BTDecoratorNode.

override void RAIN.BehaviorTrees.BTNode.SetActionContext ( ActionContext  context) [virtual]

SetActionContext sets the context "blackboard" on this node and on all children.

Parameters:
contextThe context to use

Reimplemented from RAIN.Action.Action.

virtual void RAIN.BehaviorTrees.BTNode.Sort ( ) [virtual]

Sort will reorder children based on priority, with higher priority items moved to the beginning of the list. By default Sort uses bubble sort.

Reimplemented in RAIN.BehaviorTrees.BTDecoratorNode.


Member Data Documentation

A List of child nodes. Most behavior tree nodes have ordered lists of children (leaf nodes are usually exceptions.)

If debug is true a log statement will be generated everytime this node is hit.

preconditions checked prior to start/execution a failed precondition will cause the node to return FAIL immediately