private BehaviourNode preOrderNext() { BehaviourNode current = _traversal.Pop(); for (int i = current.ChildCount() - 1; i >= 0; --i) { BehaviourNode child = current.GetChildAt(i); _traversal.Push(child); } return(current); }
private BehaviourNode PopNode() { int index = traversal.Pop(); BehaviourNode node = tree.Nodes[index]; if (node.IsComposite()) { for (int i = 0; i < node.ChildCount(); i++) { node.GetChildAt(i).OnCompositeParentExit(); } } node.OnExit(); return(node); }
private BehaviourNode PopNode() { int index = _traversal.Pop(); BehaviourNode node = _tree.allNodes[index]; node.OnExit(); // Guard against empty branch tick pop. // This could occur if a node was aborted then interrupted in succession. // TODO: Test this further. if (_branchTicks.Count != 0 && node.CanTickOnBranch()) { _branchTicks.Pop(); } return(node); }