Пример #1
0
        private void UpdateState(GameTime gameTime)
        {
            if (_state != null)
            {
                IPlayerState newState = _state.Update(this, gameTime);

                if (newState != null && _state != newState)
                {
                    _state.Exit(this);
                    _state = newState;
                    _state.Enter(this);
                }
            }
        }
Пример #2
0
    public void ChangeState(IPlayerState newState)
    {
        if (currentState != null)
        {
            currentState.Exit();
        }

        currentState = newState;
        currentState.Enter();
    }
Пример #3
0
        public void SetState(IPlayerState state)
        {
            if (m_state != null)
            {
                m_state.Exit();
            }

            m_state = state;

            m_state.Enter();
        }
    public void ChangeToState(IPlayerState state)
    {
        if (m_CurrentState != null)
        {
            m_CurrentState.Exit();
        }

        m_CurrentState = state;
        if (m_CurrentState == null)
        {
            return;
        }

        m_CurrentState.Enter(this);
    }
Пример #5
0
    public void EnterState(IPlayerState state)
    {
        if (_currentState != null)
        {
            _currentState.Exit();
        }

        if (!(state is RewindingPlayerState))
        {
            StateStack.Push(state);
        }

        _previousState = _currentState;
        _currentState  = state;
        _currentState.Enter(this);
    }
Пример #6
0
 /// <summary>
 /// 狀態改變
 /// </summary>
 /// <param name="nextState">下一個狀態</param>
 public void ChangeState(IPlayerState nextState)
 {
     StateHandle.Exit();
     StateHandle = nextState;
     StateHandle.Enter();
 }