WsfBehaviorTreeNode

WsfBehaviorTreeNode inherits WsfObject

Methods

int Id()

Returns the unique id of the node. The Id is globally unique within the simulation, even nodes of the same type on other agent’s behavior trees have a different Id.

bool Failure(string aReason)

Always returns ‘false’. Allows the user to specify the reason for a node failure condition. This method is usually only used within a behavior’s ‘precondition’ script block to indicate why the precondition is failing.

WsfBehaviorTreeNode Parent()

Returns the parent behavior node. Check if the returned node script object is valid, as you may already be at the root node.

int ChildCount()

Returns the number of child nodes owned by this node.

WsfBehaviorTreeNode ChildEntry(int aIndex)

Returns the child node at the given zero-based index. Check if the returned node script object is valid, as you may be requesting a node at an invalid index.

void TurnOff()

Turns the node off. This results in the node never being visited by the tree, nor any of its children. It is functionally the same as if the node’s precondition always fails.

void TurnOn()

Turns the node on. This method is only useful if a node has previously been turned off, as all nodes start in the “on” setting. Please note, even if a node is on, it won’t necessarily pass its precondition, it will simply be visited by the tree if appropriate (depending on the structure of the tree).