//------------------------------------------------------ protected override bool onEvaluate(/*in*/ TBTWorkingData wData) { UpdateLogicData(wData); GuideRoot_01Context thisContext = getContext <GuideRoot_01Context>(wData); int checkedNodeIndex = -1; if (IsIndexValid(thisContext.currentSelectedIndex)) { checkedNodeIndex = thisContext.currentSelectedIndex; } else { checkedNodeIndex = 0; } if (IsIndexValid(checkedNodeIndex)) { TBTAction node = GetChild <TBTAction>(checkedNodeIndex); if (node.Evaluate(wData)) { thisContext.currentSelectedIndex = checkedNodeIndex; return(true); } } return(false); }
protected override void onTransition(TBTWorkingData wData) { GuideRoot_01Context thisContext = getContext <GuideRoot_01Context>(wData); TBTAction node = GetChild <TBTAction>(thisContext.currentSelectedIndex); if (node != null) { node.Transition(wData); } }
protected override int onUpdate(TBTWorkingData wData) { GuideRoot_01Context thisContext = getContext <GuideRoot_01Context>(wData); int runningStatus = TBTRunningStatus.FINISHED; TBTAction node = GetChild <TBTAction>(thisContext.currentSelectedIndex); runningStatus = node.Update(wData); if (_continueIfErrorOccors == false && TBTRunningStatus.IsError(runningStatus)) { thisContext.currentSelectedIndex = -1; return(runningStatus); } return(runningStatus); }
protected void UpdateLogicData(TBTWorkingData _data) { GuideWorkingData gData = _data.As <GuideWorkingData>(); if (gData != null && m_nLogicStepID != gData.GuideDynamicBB.GetValue <int>(EGuideBBKey.LogicStepID, -1)) { if (m_nLogicStepID != -1) { Transition(_data); } m_nLogicStepID = gData.GuideDynamicBB.GetValue <int>(EGuideBBKey.LogicStepID, -1); GuideRoot_01Context thisContext = getContext <GuideRoot_01Context>(_data); thisContext.currentSelectedIndex++; if (!IsIndexValid(thisContext.currentSelectedIndex)) { thisContext.currentSelectedIndex = -1; } } }