コード例 #1
0
        public BehaviourTreeStatus Tick(
            BehaviourTreeExecutor <TBlackboard> executor,
            BehaviourTreeExecutionData <TBlackboard> data,
            TBlackboard blackboard)
        {
            Logger.Instance.Log(LogLevel.Trace, "[BT] {0} ", Name);

            if (data.Statuses[Id] != BehaviourTreeStatus.Running)
            {
                data.Statuses[Id] = BehaviourTreeStatus.Uninitialized;
                Initialize(executor, data, blackboard);
            }

            var status = Update(executor, data, blackboard);

            data.Statuses[Id] = status;

            if (status != BehaviourTreeStatus.Running)
            {
                OnTerminate(data, status);
            }

            Logger.Instance.Log(LogLevel.Trace, "[BT] {0} {1}", Name, status);

            return(status);
        }
コード例 #2
0
 protected override void Deactivate(BehaviourTreeExecutionData <TBlackboard> instance)
 {
     instance.Deactivate();
 }
コード例 #3
0
 protected override BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard)
 {
     return(BehaviourTreeStatus.Running);
 }
コード例 #4
0
 public void OnComplete(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> execution, BehaviourTreeStatus status)
 {
     executor.Stop(execution, this, InvertStatus(status));
 }
コード例 #5
0
 public override void Initialize(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard)
 {
     executor.Start(data, Node, this);
 }
コード例 #6
0
 public void Abort(BehaviourTreeExecutionData <TBlackboard> data)
 {
     data.Statuses[Id] = BehaviourTreeStatus.Aborted;
     OnTerminate(data, BehaviourTreeStatus.Aborted);
 }
コード例 #7
0
 public virtual void OnTerminate(BehaviourTreeExecutionData <TBlackboard> behaviourTreeExecutor, BehaviourTreeStatus status)
 {
 }
コード例 #8
0
 protected abstract BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard);
コード例 #9
0
 public virtual void Initialize(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard)
 {
     // nothing to do
 }
コード例 #10
0
 public bool IsRunning(BehaviourTreeExecutionData <TBlackboard> executionData)
 {
     return(executionData.Statuses[Id] == BehaviourTreeStatus.Running);
 }
コード例 #11
0
        public bool IsTerminated(BehaviourTreeExecutionData <TBlackboard> executionData)
        {
            var status = executionData.Statuses[Id];

            return(status == BehaviourTreeStatus.Success || status == BehaviourTreeStatus.Failure);
        }
コード例 #12
0
 protected override BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard)
 {
     return(_predicate(blackboard) ? BehaviourTreeStatus.Success : BehaviourTreeStatus.Failure);
 }
コード例 #13
0
 public BehaviourTreeMetadata(BehaviourTreeNode <TBlackboard> root)
 {
     root.DeclareNode(this);
     _pool = new BehaviourTreeExecutionData <TBlackboard> .Pool(this);
 }