Exemplo n.º 1
0
 private PrioritisedBehaviour NewRandomDestinationTree()
 {
     PrioritisedBehaviour randDest = new PrioritisedBehaviour();
     randDest.behaviourTree = new SimpleRandomMove(this);
     randDest.priority = 1;
     return randDest;
 }
Exemplo n.º 2
0
    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();
            }

        }
    }
Exemplo n.º 3
0
 protected void AddTree(BehaviourTree tree, int priority)
 {
     PrioritisedBehaviour insert = new PrioritisedBehaviour();
     insert.behaviourTree = tree;
     insert.priority = priority;
     AddTree(insert);
 }