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...
Public Member Functions | |
BTNode (string nodeName) | |
Standard constructor. Initializes name and child list. | |
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 | |
ConditionalExpression | 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.) |
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.
RAIN.BehaviorTrees.BTNode.BTNode | ( | string | nodeName | ) |
Standard constructor. Initializes name and child list.
nodeName | Name of the new node. Can be used when searching through the tree. Not guaranteed unique. |
virtual void RAIN.BehaviorTrees.BTNode.AddChild | ( | BTNode | child | ) | [virtual] |
AddChild will add a child node and then re-sort the child list.
child | The behavior tree node to add |
Reimplemented in RAIN.GOB.GOBTree.GOBActionNode, RAIN.BehaviorTrees.BTParallelNode, RAIN.BehaviorTrees.BTDecoratorNode, RAIN.GOB.GOBTree.GOBGoalNode, and RAIN.GOB.GOBTree.GOBTreeNode.
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.
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.
actionName |
Reimplemented in RAIN.GOB.GOBTree.GOBActionNode, RAIN.BehaviorTrees.BTDecoratorNode, RAIN.GOB.GOBTree.GOBGoalNode, and RAIN.GOB.GOBTree.GOBTreeNode.
override void RAIN.BehaviorTrees.BTNode.SetActionContext | ( | ActionContext | context | ) | [virtual] |
SetActionContext sets the context "blackboard" on this node and on all children.
context | The 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.
List<BTNode> RAIN.BehaviorTrees.BTNode._children [protected] |
A List of child nodes. Most behavior tree nodes have ordered lists of children (leaf nodes are usually exceptions.)
bool RAIN.BehaviorTrees.BTNode.debug = false |
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