//------------------------------------------------------ protected override bool OnEvaluate(/*in*/ BTWorkingData wData) { var thisContext = (BTCActionParallel *)wData.GetContext(_uniqueKey); thisContext->evaluationStatus.Init(false); bool finalResult = false; for (int i = 0; i < GetChildCount(); ++i) { BTAction node = GetChild <BTAction>(i); bool ret = node.Evaluate(wData); //early break if (_evaluationRelationship == ECHILDREN_RELATIONSHIP.AND && ret == false) { finalResult = false; break; } if (ret == true) { finalResult = true; } thisContext->evaluationStatus[i] = ret; } return(finalResult); }
protected override bool OnEvaluate(/*in*/ BTWorkingData wData) { var thisContext = (BTCActionNonPrioritizedSelector *)wData.GetContext(_uniqueKey); //check last node first if (IsIndexValid(thisContext->currentSelectedIndex)) { BTAction node = GetChild <BTAction>(thisContext->currentSelectedIndex); if (node.Evaluate(wData)) { return(true); } } return(base.OnEvaluate(wData)); }
//------------------------------------------------------- protected override bool OnEvaluate(/*in*/ BTWorkingData wData) { var thisContext = (BTActionLoopContext *)wData.GetContext(_uniqueKey); bool checkLoopCount = (_loopCount == INFINITY || thisContext->currentCount < _loopCount); if (checkLoopCount == false) { return(false); } if (IsIndexValid(0)) { BTAction node = GetChild <BTAction>(0); return(node.Evaluate(wData)); } return(false); }
protected override bool OnEvaluate(/*in*/ BTWorkingData wData) { var thisContext = (BTCActionPrioritizedSelector *)wData.GetContext(_uniqueKey); thisContext->currentSelectedIndex = -1; int childCount = GetChildCount(); for (int i = 0; i < childCount; ++i) { BTAction node = GetChild <BTAction>(i); if (node.Evaluate(wData)) { thisContext->currentSelectedIndex = i; return(true); } } return(false); }
//------------------------------------------------------ protected override bool OnEvaluate(/*in*/ BTWorkingData wData) { var thisContext = (BTCActionSequence *)wData.GetContext(_uniqueKey); int checkedNodeIndex = -1; if (IsIndexValid(thisContext->currentSelectedIndex)) { checkedNodeIndex = thisContext->currentSelectedIndex; } else { checkedNodeIndex = 0; } if (IsIndexValid(checkedNodeIndex)) { BTAction node = GetChild <BTAction>(checkedNodeIndex); if (node.Evaluate(wData)) { thisContext->currentSelectedIndex = checkedNodeIndex; return(true); } } return(false); }