Game Development Reference
In-Depth Information
The shoot behavior
The shoot behavior is identical to reloading, except that we must traverse back to the parent
selector node to add the shoot sequence:
SoldierLogic.lua :
function SoldierLogic_BehaviorTree(userData)
...
-- shoot action
node = node:GetParent();
node = node:GetParent();
child = CreateSequence();
node:AddChild(child);
node = child;
child = CreateCondition(
"can shoot enemy", SoldierEvaluators_CanShootAgent);
node:AddChild(child);
node = child;
node = node:GetParent();
child = CreateAction("shoot", ShootAction(userData));
node:AddChild(child);
node = child;
Search WWH ::




Custom Search