private void Update()
    {
        // handle StateMachine
        AbstractState newState = currentState.UpdateState();

        if (newState != null)
        {
            currentState.OnExit();
            currentState = newState;
            currentState.OnEnter();
        }
    }
示例#2
0
        public void Run()
        {
            AbstractState <T> previous = currentState;

            if (Manager.GetNewState(ref currentState))
            {
                previous.OnExit(Entity);
                currentState.OnEnter(Entity);
                currentState.InState(Entity);
            }
            else
            {
                currentState.InState(Entity);
            }
        }