public void DoStateChange(GameState newState)
    {
        if (oldGameState == newState)
            return;

        gameDataController.PlayState = newState;

        // hide the main menu canvas
        if (oldGameState == GameState.MENU)
        {
            DialogManager.Hide("MainMenu");
        }

        if (oldGameState == GameState.SPIN)
        {
            //hide the spinner
            DialogManager.Hide("Spinner");
        }

        if (oldGameState == GameState.OVER)
        {
            // hide the game over menu
            DialogManager.Hide("GameOver");
        }

        if (newState == GameState.SPIN)
        {
            if (oldGameState == GameState.BAD_PIGGY || oldGameState == GameState.FENCE)
            {
                // switch to next player
                GameController.Instance.NextPlayer();
            }

            //bring up spinner
            DialogManager.Show("Spinner");
        }

        if (newState == GameState.OVER)
        {
            DialogManager.Show("GameOver");
        }

        if (newState == GameState.MENU)
        {
            DialogManager.Show("MainMenu");
        }

        gameBoardScript.ReceiveStateChange(newState);

        oldGameState = newState;
        gameDataController.SaveGameData();
    }
예제 #2
0
 private void OnApplicationQuit()
 {
     GameDataController.SaveGameData();
 }
예제 #3
0
 private void OnApplicationPause(bool pauseStatus)
 {
     GameDataController.SaveGameData();
 }