Beispiel #1
0
        public DecoratorNode(Func <BehaviourTreeInstance, ExecutionResult> func, BehaviourTreeBase action)
        {
            this.Init();

            this.conditionFunction = func;

            this.action = action;
        }
        /// <summary>

        /// 状態をリセットして初めから実行する

        /// </summary>

        public void Reset()
        {
            nodeStateDict.Clear();

            this.finishRP.Value = NodeState.READY;

            this.rootNode.Reset();

            this.rootNode = null;

            //this.rootNode.Execute(this);
        }
Beispiel #3
0
        public BehaviourTreeInstance(BehaviourTreeBase _rootNode)
        {
            rootNode = _rootNode;

            nodeStateDic.ObserveAdd()
            .Where(item => item.Value == NodeState.READY)
            .Subscribe(item => SetCurrentNodeKey(item.Key));

            nodeStateDic.ObserveReplace()
            .Where(item => item.Key == rootNode.key)
            .Where(item => item.NewValue == NodeState.FAILURE || item.NewValue == NodeState.SUCCESS)
            .Subscribe(item => Finish(item.NewValue));
        }
        public BehaviourTreeInstance(BehaviourTreeBase rootNode)
        {
            this.rootNode = rootNode;


            this.nodeStateDict.ObserveAdd()

            .Where(p => p.Value == NodeState.READY)

            .Subscribe(p => SetCurrentNodeKey(p.Key));


            this.nodeStateDict.ObserveReplace()

            .Where(p => p.Key == rootNode.key)

            .Where(p => p.NewValue == NodeState.FAILURE || p.NewValue == NodeState.SUCCESS)

            .Subscribe(p => Finish(p.NewValue));
        }
Beispiel #5
0
 public DecoratorNode(Func <BehaviourTreeInstance, ExecutionResult> _func, BehaviourTreeBase _action)
 {
     Init();
     conditionFunction = _func;
     action            = _action;
 }