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); } } }
public void ChangeState(IPlayerState newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; currentState.Enter(); }
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); }
public void EnterState(IPlayerState state) { if (_currentState != null) { _currentState.Exit(); } if (!(state is RewindingPlayerState)) { StateStack.Push(state); } _previousState = _currentState; _currentState = state; _currentState.Enter(this); }
/// <summary> /// 狀態改變 /// </summary> /// <param name="nextState">下一個狀態</param> public void ChangeState(IPlayerState nextState) { StateHandle.Exit(); StateHandle = nextState; StateHandle.Enter(); }