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); }
protected override void Deactivate(BehaviourTreeExecutionData <TBlackboard> instance) { instance.Deactivate(); }
protected override BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard) { return(BehaviourTreeStatus.Running); }
public void OnComplete(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> execution, BehaviourTreeStatus status) { executor.Stop(execution, this, InvertStatus(status)); }
public override void Initialize(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard) { executor.Start(data, Node, this); }
public void Abort(BehaviourTreeExecutionData <TBlackboard> data) { data.Statuses[Id] = BehaviourTreeStatus.Aborted; OnTerminate(data, BehaviourTreeStatus.Aborted); }
public virtual void OnTerminate(BehaviourTreeExecutionData <TBlackboard> behaviourTreeExecutor, BehaviourTreeStatus status) { }
protected abstract BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard);
public virtual void Initialize(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard) { // nothing to do }
public bool IsRunning(BehaviourTreeExecutionData <TBlackboard> executionData) { return(executionData.Statuses[Id] == BehaviourTreeStatus.Running); }
public bool IsTerminated(BehaviourTreeExecutionData <TBlackboard> executionData) { var status = executionData.Statuses[Id]; return(status == BehaviourTreeStatus.Success || status == BehaviourTreeStatus.Failure); }
protected override BehaviourTreeStatus Update(BehaviourTreeExecutor <TBlackboard> executor, BehaviourTreeExecutionData <TBlackboard> data, TBlackboard blackboard) { return(_predicate(blackboard) ? BehaviourTreeStatus.Success : BehaviourTreeStatus.Failure); }
public BehaviourTreeMetadata(BehaviourTreeNode <TBlackboard> root) { root.DeclareNode(this); _pool = new BehaviourTreeExecutionData <TBlackboard> .Pool(this); }