public override bool NeedRestart() { BehaviorTask root = this.m_root; if (root != null && root.NeedRestart()) { return(true); } return(false); }
protected EBTStatus tickCurrentNode(Agent pAgent) { Debug.Check(this.m_currentTask != null); EBTStatus s = this.m_currentTask.GetStatus(); if (s == EBTStatus.BT_INVALID || s == EBTStatus.BT_RUNNING) { //this.m_currentTask could be cleared in ::tick, to remember it BehaviorTask currentTask = this.m_currentTask; EBTStatus status = this.m_currentTask.exec(pAgent); //give the handling back to parents if (status != EBTStatus.BT_RUNNING) { Debug.Check(currentTask.m_status == EBTStatus.BT_SUCCESS || currentTask.m_status == EBTStatus.BT_FAILURE || (currentTask.m_status == EBTStatus.BT_INVALID && currentTask.NeedRestart())); BranchTask parentBranch = currentTask.GetParent(); this.SetCurrentTask(null); //back track the parents until the branch while (parentBranch != null && parentBranch != this) { status = parentBranch.update(pAgent, status); if (status == EBTStatus.BT_RUNNING) { return(EBTStatus.BT_RUNNING); } parentBranch.onexit_action(pAgent, status); parentBranch.m_status = status; Debug.Check(parentBranch.m_currentTask == null); parentBranch = parentBranch.GetParent(); } } return(status); } return(s); }
public override bool NeedRestart() { BehaviorTask root = base.m_root; return((root != null) && root.NeedRestart()); }
public override bool NeedRestart() { BehaviorTask root = this.m_root; return(root != null && root.NeedRestart()); }