Game Development Reference
In-Depth Information
Updating the behavior tree node
With local functions fleshed out, we can fully encapsulate our behavior tree node function-
ality:
BehaviorTreeNode.lua :
function BehaviorTreeNode.new(name, type)
local node = {};
...
-- The BehaviorTreeNode's accessor functions.
node.AddChild = BehaviorTreeNode.AddChild;
node.ChildIndex = BehaviorTreeNode.ChildIndex;
node.GetChild = BehaviorTreeNode.GetChild;
node.GetNumberOfChildren =
BehaviorTreeNode.GetNumberOfChildren;
node.GetParent = BehaviorTreeNode.GetParent;
node.SetAction = BehaviorTreeNode.SetAction;
node.SetEvaluator = BehaviorTreeNode.SetEvaluator;
node.SetType = BehaviorTreeNode.SetType;
return node;
end
Search WWH ::




Custom Search