public override void SetTreeDepth(int depth) { base.SetTreeDepth(depth); if(child != null) { child.SetTreeDepth(depth + 1); } }
public BTTree(BTTask root) { blackboard = new Blackboard(); child = root; root.SetTreeDepth(0); BeginTree(); }
//adds an action as a child to this node public void AddTask(BTTask newAction) { for (int i = 0; i < children.Count; i++) { if (children[i].GetName() == newAction.GetName()) { return; } } children.Add(newAction); newAction.SetTreeDepth(treeDepth + 1); }