public override void Initialize() { base.Initialize(); RegisterClientEvt(); m_curState = new GameMenuState(); m_curState.OnStateBegin(); }
public void TransitionToGameState(GameBaseState state) { _currentGameState?.Leave(this); _previousGameState = _currentGameState; _currentGameState = state; _currentGameState.Enter(this); }
public void SwitchGameState(EGAME_STATE_TYPE type) { if (m_curState == null) { return; } m_curState.OnStateEnd(); if (m_curState.GameState != type) { m_curState.OnStateEnd(); switch (type) { case EGAME_STATE_TYPE.EGAME_STATE_BASE: { m_curState = new GameBaseState(); } break; case EGAME_STATE_TYPE.EGAME_STATE_MENU: { m_curState = new GameMenuState(); } break; case EGAME_STATE_TYPE.EGAME_STATE_GAME: { m_curState = new GameRunState(); } break; } } }
public void SwitchGameState(EGAME_STATE_TYPE type) { if (m_curState == null) { m_curState.OnStateEnd(); } else if (m_curState.GameState != type) { m_curState.OnStateEnd(); switch (type) { case EGAME_STATE_TYPE.EGAME_STATE_BASE: { m_curState = new GameBaseState(); } break; } } }
public void TransitionState(GameBaseState newGameState) { switch (newGameState) { case GameBaseState.PREPLAY: PrePlay(); break; case GameBaseState.PLAY: PlayGame(); break; case GameBaseState.PAUSE: PauseGame(); break; case GameBaseState.GAMEOVER: break; } GameState = newGameState; }
public void TransistinoToState(GameBaseState state) { currentState = state; currentState.EnterState(this); }
public void TransitionToState(GameBaseState state) { currentGameState = state; currentGameState.EnterState(this); }
// Transition between game states public void TransitionToState(GameBaseState State) { CurrentState = State; CurrentState.EnterState(this); TimeInState = 0.0f; }