Game Development Reference
In-Depth Information
The death behavior
To add the first action, which is death, we add the required sequence, condition, and action
nodes. As the behavior tree will completely re-evaluate once an action completes, we don't
have to worry about other actions knowing about death. As prioritizing actions is based on
how early in the tree they appear, we add death first, because it has the highest priority:
SoldierLogic.lua :
function SoldierLogic_BehaviorTree(userData)
...
-- die action
child = CreateSequence();
node:AddChild(child);
node = child;
child = CreateCondition(
"is not alive", SoldierEvaluators_IsNotAlive);
node:AddChild(child);
node = child;
node = child:GetParent();
child = CreateAction("die", DieAction(userData));
node:AddChild(child);
node = child;
return tree;
end
Search WWH ::




Custom Search