protected override NodeRunningStatus UpdateInternal(object rInput, object rOutput) { NodeRunningStatus rIsFinish = NodeRunningStatus.Finish; if (CheckIndexSafe(mSelectIndexCur)) { if (mSelectIndexLast != mSelectIndexCur) { if (CheckIndexSafe(mSelectIndexLast)) { var rNode = mChildren[mSelectIndexLast]; rNode.Transition(rInput); } mSelectIndexLast = mSelectIndexCur; } } if (CheckIndexSafe(mSelectIndexLast)) { var rNode = mChildren[mSelectIndexLast]; rIsFinish = rNode.Update(rInput, rOutput); if (rIsFinish != NodeRunningStatus.Executing) { mSelectIndexLast = _invalidChildNodeIndex; } } return(rIsFinish); }
protected override NodeRunningStatus UpdateInternal(object rInput, object rOutput) { NodeRunningStatus rIsFinish = NodeRunningStatus.Finish; if (CheckIndexSafe(0)) { var rNode = mChildren[0]; rIsFinish = rNode.Update(rInput, rOutput); if (rIsFinish == NodeRunningStatus.Finish) { if (mLoopCount != _infiniteLoop) { mCountCur++; if (mCountCur == mLoopCount) { rIsFinish = NodeRunningStatus.Executing; } } else { rIsFinish = NodeRunningStatus.Executing; } } } if (rIsFinish != NodeRunningStatus.Executing) { mCountCur = 0; } return(rIsFinish); }
protected override NodeRunningStatus UpdateInternal(object rInput, object rOutput) { NodeRunningStatus rIsFinish = NodeRunningStatus.Finish; if (mNodeIndexCur == BehaviorTreeNode._invalidChildNodeIndex) { mNodeIndexCur = 0; } var rNode = mChildren[mNodeIndexCur]; rIsFinish = rNode.Update(rInput, rOutput); if (rIsFinish == NodeRunningStatus.Finish) { mNodeIndexCur++; if (mNodeIndexCur == mChildrenCount) { mNodeIndexCur = BehaviorTreeNode._invalidChildNodeIndex; } else { rIsFinish = NodeRunningStatus.Executing; } } if (rIsFinish == NodeRunningStatus.TransitionError) { mNodeIndexCur = BehaviorTreeNode._invalidChildNodeIndex; } return(rIsFinish); }
protected override NodeRunningStatus UpdateInternal(OutputParam rInput, OutputParam rOutput) { NodeRunningStatus rIsFinish = NodeRunningStatus.Finish; if (mActionStatus == NodeActionStaus.Ready) { Enter(rInput); mNeedExit = true; mActionStatus = NodeActionStaus.Running; SetActiveNode(this); } if (mActionStatus == NodeActionStaus.Running) { rIsFinish = Execute(rInput, rOutput); SetActiveNode(this); if (rIsFinish != NodeRunningStatus.Executing) { mActionStatus = NodeActionStaus.Finish; } } if (mActionStatus == NodeActionStaus.Finish) { if (mNeedExit) { Exit(rInput, rIsFinish); } mActionStatus = NodeActionStaus.Ready; mNeedExit = false; SetActiveNode(null); return(rIsFinish); } return(rIsFinish); }
protected virtual void Exit(InputParam rInput, NodeRunningStatus rExitID) { }
protected virtual void Exit(InputParam rInput, NodeRunningStatus rExitID) { }