private PrioritisedBehaviour NewRandomDestinationTree() { PrioritisedBehaviour randDest = new PrioritisedBehaviour(); randDest.behaviourTree = new SimpleRandomMove(this); randDest.priority = 1; return randDest; }
protected void AddTree(PrioritisedBehaviour prioritisedBehaviour) { if(alive){ // Debug.Log (gameObject + " began Tree: " + prioritisedBehaviour.behaviourTree); for (int i = 0; i < behaviourQueue.Count; i++){ if(behaviourQueue[i].priority < prioritisedBehaviour.priority){ if(i == 0){ behaviourQueue[0].behaviourTree.root.Interrupt(); } behaviourQueue.Insert(i, prioritisedBehaviour); if(i==0 && prioritisedBehaviour.behaviourTree != null){ behaviourQueue[0].behaviourTree.Start(); } return; } } behaviourQueue.Add(prioritisedBehaviour); if(behaviourQueue.Count == 1 && prioritisedBehaviour.behaviourTree != null){ //Debug.Log(gameObject + " began Tree: " + prioritisedBehaviour.behaviourTree); behaviourQueue[0].behaviourTree.Start(); } } }
protected void AddTree(BehaviourTree tree, int priority) { PrioritisedBehaviour insert = new PrioritisedBehaviour(); insert.behaviourTree = tree; insert.priority = priority; AddTree(insert); }