BTParallelNode is a behavior tree node for allowing child nodes to operate in parallel. Since Unity runs behavior single threaded, nodes are processed in priority order (pre-sorted). However, at each Execute step all active children are given an opportunity to execute even if higher priority nodes fail. More...
Public Member Functions | |
BTParallelNode (string nodeName) | |
Constructor. | |
override void | AddChild (BTNode child) |
AddChild adds a BehaviorTree node to the child list. | |
override ActionResult | Start (Agent agent, float deltaTime) |
Start Action handler. If a child fails during Start, and if failOnSingle is true, then FAILURE is returned. Whether FAILURE or SUCCESS if returned, all children's states are reset to RUNNING. | |
override ActionResult | Execute (Agent agent, float deltaTime) |
Execute loops through all children whose prior state was RUNNING and Executes them. It then calculates a return value based on failOn flags. | |
override ActionResult | Stop (Agent agent, float deltaTime) |
Stop Action handler. All children are stopped. | |
Public Attributes | |
const string | NODETYPE = "parallel" |
Node type, used in xml parsing. | |
bool | failOnSingle = false |
Does a single failure cause the entire parallel action to fail? This is often the case if the parallel action is used to support persistent constraints as parallel conditional nodes. | |
bool | succeedOnSingle = false |
Does a single success cause the entire parallel action to immediately succeed? This is often the case if the parallel action is used to support multiple solutions to the same problem, or to terminate if a problem is solved by some other action. | |
bool | failOnTie = true |
If both failOnSingle is true and succeedOnSingle is true, and both happen at the same timestep, does fail win? |
BTParallelNode is a behavior tree node for allowing child nodes to operate in parallel. Since Unity runs behavior single threaded, nodes are processed in priority order (pre-sorted). However, at each Execute step all active children are given an opportunity to execute even if higher priority nodes fail.
Users can choose how failure or success impacts the overall node state.
RAIN.BehaviorTrees.BTParallelNode.BTParallelNode | ( | string | nodeName | ) |
Constructor.
nodeName | The name of the node to create |
override void RAIN.BehaviorTrees.BTParallelNode.AddChild | ( | BTNode | child | ) | [virtual] |
AddChild adds a BehaviorTree node to the child list.
child | The behavior tree node to add |
Reimplemented from RAIN.BehaviorTrees.BTNode.
override ActionResult RAIN.BehaviorTrees.BTParallelNode.Execute | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Execute loops through all children whose prior state was RUNNING and Executes them. It then calculates a return value based on failOn flags.
agent | AI Agent owner of the behavior tree |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
override ActionResult RAIN.BehaviorTrees.BTParallelNode.Start | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Start Action handler. If a child fails during Start, and if failOnSingle is true, then FAILURE is returned. Whether FAILURE or SUCCESS if returned, all children's states are reset to RUNNING.
agent | AI Agent owner of the behavior tree |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
override ActionResult RAIN.BehaviorTrees.BTParallelNode.Stop | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Stop Action handler. All children are stopped.
agent | AI Agent owner of the behavior tree |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
bool RAIN.BehaviorTrees.BTParallelNode.failOnSingle = false |
Does a single failure cause the entire parallel action to fail? This is often the case if the parallel action is used to support persistent constraints as parallel conditional nodes.
bool RAIN.BehaviorTrees.BTParallelNode.failOnTie = true |
If both failOnSingle is true and succeedOnSingle is true, and both happen at the same timestep, does fail win?
const string RAIN.BehaviorTrees.BTParallelNode.NODETYPE = "parallel" |
Node type, used in xml parsing.
bool RAIN.BehaviorTrees.BTParallelNode.succeedOnSingle = false |
Does a single success cause the entire parallel action to immediately succeed? This is often the case if the parallel action is used to support multiple solutions to the same problem, or to terminate if a problem is solved by some other action.