Game Development Reference
In-Depth Information
Once we've created each branch in our decision tree, we'll begin to hook up the parent-
child relationships between branches as well as add leaf node actions.
Enemy and no enemy decision branches
As our decision tree follows a binary tree design, each branch will typically have one ac-
tion and another branch. Branches at the tips of the tree will end with two different ac-
tions:
SoldierLogic.lua :
function SoldierLogic_DecisionTree(userData)
...
isAliveBranch:AddChild(criticalBranch);
isAliveBranch:AddChild(DieAction(userData));
isAliveBranch:SetEvaluator(
function()
if SoldierEvaluators_IsNotAlive(userData) then
return 2;
end
return 1;
end);
Search WWH ::




Custom Search