示例#1
0
        public void SetActiveTree(ExternalBehaviorTree tree)
        {
            if (tree == null)
            {
                Debug.LogError("Null tree provided to \"SetActiveTree\" function!");
                return;
            }
            ExternalBehaviorTree extree = Object.Instantiate(tree);

            extree.Init();
            GetComponent <BehaviorTree>().DisableBehavior();
            GetComponent <BehaviorTree>().ExternalBehavior = extree;
            GetComponent <BehaviorTree>().EnableBehavior();
        }
示例#2
0
        public void SetActiveTree(AIActiveState input)
        {
            ExternalBehaviorTree extree = null;

            switch (input)
            {
            case AIActiveState.Calm:
                extree = Object.Instantiate(traits.calmTree);
                break;

            case AIActiveState.Suspicious:
                extree = Object.Instantiate(traits.suspiciousTree);
                break;

            case AIActiveState.Hostile:
                extree = Object.Instantiate(traits.hostileTree);
                break;
            }
            extree.Init();
            GetComponent <BehaviorTree>().DisableBehavior();
            GetComponent <BehaviorTree>().ExternalBehavior = extree;
            GetComponent <BehaviorTree>().EnableBehavior();
        }