コード例 #1
0
ファイル: GenericManager.cs プロジェクト: rdstn/Project
 private PrioritisedBehaviour NewRandomDestinationTree()
 {
     PrioritisedBehaviour randDest = new PrioritisedBehaviour();
     randDest.behaviourTree = new SimpleRandomMove(this);
     randDest.priority = 1;
     return randDest;
 }
コード例 #2
0
ファイル: EventManager.cs プロジェクト: rdstn/Project
    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();
            }

        }
    }
コード例 #3
0
ファイル: EventManager.cs プロジェクト: rdstn/Project
 protected void AddTree(BehaviourTree tree, int priority)
 {
     PrioritisedBehaviour insert = new PrioritisedBehaviour();
     insert.behaviourTree = tree;
     insert.priority = priority;
     AddTree(insert);
 }