コード例 #1
0
        private static void BindHotfixDecorators(BehaviorTreeComponent self, BehaviorTree behaviorTree)
        {
            var tasks = behaviorTree.Behavior.FindTasks <HotfixDecorator>();

            if (tasks == null)
            {
                return;
            }

            foreach (var hotfixDecorator in tasks)
            {
                var component = BehaviorTreeComponentFactory.Create(behaviorTree, hotfixDecorator);

                if (component != null)
                {
                    self.DecoratorComponents.Add(hotfixDecorator, component);
                }
            }
        }
コード例 #2
0
        public static void Awake(this BehaviorTreeComponent self, BehaviorTree behaviorTree)
        {
            if (behaviorTree == null || behaviorTree.Behavior == null)
            {
                return;
            }

            self.BehaviorTree = behaviorTree;

            behaviorTree.Behavior.StartWhenEnabled     = false;
            behaviorTree.Behavior.ResetValuesOnRestart = false;

            BindHotfixActions(self, behaviorTree);
            BindHotfixComposites(self, behaviorTree);
            BindHotfixConditionals(self, behaviorTree);
            BindHotfixDecorators(self, behaviorTree);

            behaviorTree.Behavior.EnableBehavior();
        }
コード例 #3
0
        private static void BindHotfixConditionals(BehaviorTreeComponent self, BehaviorTree behaviorTree)
        {
            var tasks = behaviorTree.Behavior.FindTasks <HotfixConditional>();

            if (tasks == null)
            {
                return;
            }

            foreach (var hotfixConditional in tasks)
            {
                var component = BehaviorTreeComponentFactory.Create(behaviorTree, hotfixConditional);

                if (component != null)
                {
                    self.ConditionalComponents.Add(hotfixConditional, component);
                }
            }
        }
コード例 #4
0
 public static void DisableBehavior(this BehaviorTreeComponent self)
 {
     self?.BehaviorTree?.Behavior?.DisableBehavior();
 }