protected override BTreeRunningStatus _DoTick(BTreeTemplateData _input, ref BTreeTemplateData _output) { BTreeRunningStatus runningStatus = base._DoTick(_input, ref _output); if (_CheckIndex(0)) { BTreeNode bn = m_ChildNodes[0]; runningStatus = bn.Tick(_input, ref _output); if (runningStatus == BTreeRunningStatus.Finish) { if (m_LoopCount != INFINITELOOP) { m_CurrentCount++; if (m_CurrentCount == m_LoopCount) { runningStatus = BTreeRunningStatus.Executing; } } else { runningStatus = BTreeRunningStatus.Executing; } } } if (runningStatus == BTreeRunningStatus.Finish) { m_CurrentCount = 0; } return(runningStatus); }
protected override BTreeRunningStatus _DoTick(BTreeTemplateData _input, ref BTreeTemplateData _output) { base._DoTick(_input, ref _output); BTreeRunningStatus RunningStatus = BTreeRunningStatus.Finish; if (_CheckIndex(m_CurrentSelectIndex)) { if (m_LastSelectIndex != m_CurrentSelectIndex) { if (_CheckIndex(m_LastSelectIndex)) { BTreeNode bn = m_ChildNodes[m_LastSelectIndex]; bn.Transition(_input); } m_LastSelectIndex = m_CurrentSelectIndex; } } if (_CheckIndex(m_LastSelectIndex)) { BTreeNode bn = m_ChildNodes[m_LastSelectIndex]; RunningStatus = bn.Tick(_input, ref _output); if (RunningStatus == BTreeRunningStatus.Finish) { m_LastSelectIndex = INVALID_CHILD_NODE_INDEX; } } return(RunningStatus); }
protected override BTreeRunningStatus _DoTick(BTreeTemplateData _input, ref BTreeTemplateData _output) { BTreeRunningStatus runningStatus = BTreeRunningStatus.Finish; //First Time if (m_CurrentNodeIndex == INVALID_CHILD_NODE_INDEX) { m_CurrentNodeIndex = 0; } BTreeNode bn = m_ChildNodes[m_CurrentNodeIndex]; runningStatus = bn.Tick(_input, ref _output); if (runningStatus == BTreeRunningStatus.Finish) { m_CurrentNodeIndex++; if (m_CurrentNodeIndex == m_ChildCount) { m_CurrentNodeIndex = INVALID_CHILD_NODE_INDEX; } else { runningStatus = BTreeRunningStatus.Executing; } } if (runningStatus == BTreeRunningStatus.Error) { m_CurrentNodeIndex = INVALID_CHILD_NODE_INDEX; } return(runningStatus); }
protected override BTreeRunningStatus _DoTick(BTreeTemplateData _input, ref BTreeTemplateData _output) { BTreeRunningStatus runningStatus = base._DoTick(_input, ref _output); if (m_Status == BTreeNodeStatus.Ready) { _DoEnter(_input); m_NeedExit = true; m_Status = BTreeNodeStatus.Running; SetActiveNode(this); } if (m_Status == BTreeNodeStatus.Running) { runningStatus = _DoExecute(_input, ref _output); SetActiveNode(this); if (runningStatus == BTreeRunningStatus.Finish || runningStatus == BTreeRunningStatus.Error) { m_Status = BTreeNodeStatus.Finish; } } if (m_Status == BTreeNodeStatus.Finish) { if (m_NeedExit) { _DoExit(_input, runningStatus); } m_Status = BTreeNodeStatus.Ready; m_NeedExit = false; SetActiveNode(null); } return(runningStatus); }
protected virtual void _DoExit(BTreeTemplateData _input, BTreeRunningStatus _status) { Debugger.Log_Btree("_DoExit:" + m_Name); }
protected virtual void _DoExit(BTreeTemplateData _input, BTreeRunningStatus _status) { }