Exemple #1
0
        override public void OnUpdate()
        {
            if (activeState == null)
            {
                throw new System.Exception("The FSM has not been initialised yet! "
                                           + "Call fsm.SetStartState(...) and fsm.OnEnter() to initialise");
            }
            foreach (TransitionBase transition in activeTransitions)
            {
                if (!transition.ShouldTransition())
                {
                    continue;
                }

                if (!activeState.needsExitTime || transition.forceInstantly)
                {
                    ChangeState(transition.to);
                }
                else
                {
                    RequestStateChange(transition.to);
                }

                break;
            }

            activeState.OnUpdate();
        }