protected override int onUpdate(TBTWorkingData wData)
        {
            TBTActionPrioritizedSelectorContext thisContext = getContext <TBTActionPrioritizedSelectorContext>(wData);
            int runningStatus = TBTRunningStatus.FINISHED;

            if (thisContext.lastSelectedIndex != thisContext.currentSelectedIndex)
            {
                if (IsIndexValid(thisContext.lastSelectedIndex))
                {
                    TBTAction node = GetChild <TBTAction>(thisContext.lastSelectedIndex);
                    node.Transition(wData);
                }
                thisContext.lastSelectedIndex = thisContext.currentSelectedIndex;
            }
            if (IsIndexValid(thisContext.currentSelectedIndex))
            {
                TBTAction node = GetChild <TBTAction>(thisContext.currentSelectedIndex);
                runningStatus = node.Update(wData);
                if (TBTRunningStatus.IsFinished(runningStatus))
                {
                    thisContext.lastSelectedIndex = -1;
                }
            }
            return(runningStatus);
        }
예제 #2
0
        protected override void onTransition(TBTWorkingData wData)
        {
            TBTActionSequenceContext thisContext = getContext <TBTActionSequenceContext>(wData);
            TBTAction node = GetChild <TBTAction>(thisContext.currentSelectedIndex);

            if (node != null)
            {
                node.Transition(wData);
            }
        }
예제 #3
0
        protected override void onTransition(TBTWorkingData wData)
        {
            TBTActionParellelContext thisContext = getContext <TBTActionParellelContext>(wData);

            for (int i = 0; i < GetChildCount(); i++)
            {
                TBTAction node = GetChild <TBTAction>(i);
                node.Transition(wData);
            }
            initListTo <int>(thisContext.runningStatus, TBTRunningStatus.EXECUTING);
        }
        protected override void onTransition(TBTWorkingData wData)
        {
            TBTActionPrioritizedSelectorContext thisContext = getContext <TBTActionPrioritizedSelectorContext>(wData);
            TBTAction node = GetChild <TBTAction>(thisContext.lastSelectedIndex);

            if (node != null)
            {
                node.Transition(wData);
            }
            thisContext.lastSelectedIndex = -1;
        }
예제 #5
0
        protected override void onTransition(TBTWorkingData wData)
        {
            TBTActionLoopContext thisContext = getContext <TBTActionLoopContext>(wData);

            if (IsIndexValid(0))
            {
                TBTAction node = GetChild <TBTAction>(0);
                node.Transition(wData);
            }
            thisContext.currentCount = 0;
        }