Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 3
0
    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;
            }
        }
    }
Ejemplo n.º 4
0
 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;
         }
     }
 }
Ejemplo n.º 5
0
    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;
    }
Ejemplo n.º 6
0
 public void TransistinoToState(GameBaseState state)
 {
     currentState = state;
     currentState.EnterState(this);
 }
Ejemplo n.º 7
0
 public void TransitionToState(GameBaseState state)
 {
     currentGameState = state;
     currentGameState.EnterState(this);
 }
Ejemplo n.º 8
0
 // Transition between game states
 public void TransitionToState(GameBaseState State)
 {
     CurrentState = State;
     CurrentState.EnterState(this);
     TimeInState = 0.0f;
 }