BTSequence
Inherits: BTComposite < BTTask < BT
BT composite that sequentially executes tasks as long as they return SUCCESS
.
Description
BTSequence executes its child tasks sequentially, from first to last, as long as they return SUCCESS
. If a child task results in SUCCESS
, BTSequence will immediately execute the next child task until one of them returns FAILURE
or all of them result in SUCCESS
. BTSequence and BTSelector are two of the most common building blocks of behavior trees. Essentially, while BTSelector is similar to a boolean OR operation, BTSequence is similar to a boolean AND operation. Sequences enable the behavior tree to compose complex behaviors from a chain of simpler tasks.
Returns RUNNING
if any child task results in RUNNING
. BTSequence will remember the last child task that returned RUNNING
, ensuring it resumes from that point in the next execution tick.
Returns SUCCESS
if all child tasks result in SUCCESS
.
Returns FAILURE
if a child task results in FAILURE
.