예제 #1
0
파일: BTRepeater.cs 프로젝트: dqtoy/ActDemo
        public override EBTResult Tick()
        {
            EBTResult tmpResult = EBTResult.Running;

            IsRunning = true;

            do
            {
                if (!mRepeatForever)
                {
                    ++mCurrentCount;
                }

                if (mCurrentCount > mCount)
                {
                    tmpResult = EBTResult.Success;
                    IsRunning = false;
                    break;
                }

                EBTResult tmpChildResult = ChildNode.Tick();

                if (mEndOnFailure && EBTResult.Failed == tmpChildResult)
                {
                    tmpResult = EBTResult.Failed;
                    IsRunning = false;
                    break;
                }
            } while (false);

            return(tmpResult);
        }
예제 #2
0
        public override EBTResult Tick()
        {
            switch (ChildNode.Tick())
            {
            case EBTResult.Success:
            case EBTResult.Failed:
                return(EBTResult.Success);
            }

            return(EBTResult.Running);
        }
예제 #3
0
        public override EBTResult Tick()
        {
            mTime += Time.deltaTime;
            EBTResult tmpResult = EBTResult.Running;

            if (mTime >= mDelay)
            {
                tmpResult = ChildNode.Tick();
            }

            return(tmpResult);
        }
예제 #4
0
파일: BTTimer.cs 프로젝트: dqtoy/ActDemo
        public override EBTResult Tick()
        {
            mTime += Time.deltaTime;

            if (mTime >= mInterval)
            {
                mTime = 0;
                EBTResult result = ChildNode.Tick();
                return(result);
            }
            else
            {
                return(EBTResult.Running);
            }
        }
예제 #5
0
        public override EBTResult Tick()
        {
            if (!mIsConditionsComplete)
            {
                switch (mLogicOpt)
                {
                case EBTLogic.And:
                    foreach (BTConditional conditional in mConditionals)
                    {
                        if (!conditional.Check())
                        {
                            return(EBTResult.Failed);
                        }
                    }
                    break;

                case EBTLogic.Or:
                    bool anySuccess = false;

                    foreach (BTConditional conditional in mConditionals)
                    {
                        if (conditional.Check())
                        {
                            anySuccess = true;
                            break;
                        }
                    }

                    if (!anySuccess)
                    {
                        return(EBTResult.Failed);
                    }
                    break;
                }
            }

            mIsConditionsComplete = true;
            EBTResult tmpResult = ChildNode.Tick();

            if (EBTResult.Running == tmpResult)
            {
                IsRunning = true;
            }

            return(tmpResult);
        }