protected override bool onEvaluate(TBTWorkingData wData)
        {
            TBTActionPrioritizedSelectorContext thisContext = getContext <TBTActionPrioritizedSelectorContext>(wData);

            thisContext.currentSelectedIndex = -1;
            for (int i = 0; i < GetChildCount(); i++)
            {
                TBTAction node = GetChild <TBTAction>(i);
                if (node.Evaluate(wData))
                {
                    thisContext.currentSelectedIndex = i;
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        protected override bool onEvaluate(TBTWorkingData wData)
        {
            TBTActionSequenceContext thisContext = getContext <TBTActionSequenceContext>(wData);
            int checkNodeIndex = IsIndexValid(thisContext.currentSelectedIndex) ? thisContext.currentSelectedIndex : 0;

            if (IsIndexValid(checkNodeIndex))
            {
                TBTAction node = GetChild <TBTAction>(checkNodeIndex);
                if (node.Evaluate(wData))
                {
                    thisContext.currentSelectedIndex = checkNodeIndex;
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
0
        protected override bool onEvaluate(TBTWorkingData wData)
        {
            TBTActionLoopContext thisContext = getContext <TBTActionLoopContext>(wData);
            bool checkLoopCount = loopCount == INIFITY || thisContext.currentCount < loopCount;

            if (!checkLoopCount)
            {
                return(false);
            }
            if (IsIndexValid(0))
            {
                TBTAction node = GetChild <TBTAction>(0);
                return(node.Evaluate(wData));
            }
            return(false);
        }
Esempio n. 4
0
        protected override bool onEvaluate(TBTWorkingData wData)
        {
            TBTActionParellelContext thisContext = getContext <TBTActionParellelContext>(wData);

            initListTo <bool>(thisContext.evaluationStatus, false);
            bool finalResult = false;

            for (int i = 0; i < GetChildCount(); i++)
            {
                TBTAction node = GetChild <TBTAction>(i);
                bool      ret  = node.Evaluate(wData);
                if (_evaluationRelationShip == ECHILDREN_RELATIONSHIP.AND && ret == false)
                {
                    finalResult = false;
                    break;
                }
                if (ret)
                {
                    finalResult = true;
                }
                thisContext.evaluationStatus[i] = ret;
            }
            return(finalResult);
        }