Пример #1
0
        public override void UpdateCallBack(float deltaTime)
        {
            if (isTransition)
            {
                //判断当前过度是否结束
                if (tempTransition.TransitionCallBack())
                {
                    DoTransition(tempTransition);
                    isTransition = false;
                }
                return;
            }
            base.UpdateCallBack(deltaTime);
            //如果当前状态为空了,则将当前状态设为默认状态
            if (currentState == null)
            {
                currentState = defaultState;
            }
            List <ITransition> temp = currentState.Transitions;
            int count = temp.Count;

            for (int i = 0; i < count; i++)
            {
                ITransition it = temp[i];
                //满足条件可以开始过度
                if (it.IsBeginTransition())
                {
                    isTransition   = true;
                    tempTransition = it;
                    return;
                }
            }
            currentState.UpdateCallBack(deltaTime);
        }