예제 #1
0
        private void RoleButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            NextGameState next = new NextGameState();

            next.Value = storydialogs;
            next.Type  = type;

            RuntimeData.Instance.gameEngine.CallScence(null, next);
        }
예제 #2
0
    public GameStateManager(Game1 game)
    {
        this.game = game;

        nextGameState = NextGameState.MainMenu;

        currentGameState = new MainMenu(game);

        inputHandler = new InputHandler();
    }
예제 #3
0
    private void ChangeGameState()
    {
        //changes currentGameState to a different GameState if needed
        if (nextGameState != currentGameState.NextGameState)
        {
            if (currentGameState.NextGameState == NextGameState.MainMenu)
            {
                currentGameState = new MainMenu(game);
            }
            else if (currentGameState.NextGameState == NextGameState.GameModeMenu)
            {
                currentGameState = new GameModeMenu(game);
            }
            else if (currentGameState.NextGameState == NextGameState.PauseMenu)
            {
                //temporaryGameState is used to save the game when changing gameState to PauseMenu
                temporaryGameState = currentGameState;
                currentGameState   = new PauseMenu(game);
            }
            else if (currentGameState.NextGameState == NextGameState.PlayingState)
            {
                //get the chosen game mode
                PlayingState.GameMode gameMode = currentGameState.GetGameMode;

                //when changing to PlayingState, check if a game is saved
                if (temporaryGameState != null)
                {
                    currentGameState = temporaryGameState;
                    currentGameState.NextGameState = NextGameState.PlayingState;
                }
                else
                {
                    currentGameState = new PlayingState(game, gameMode);
                }
            }
            else if (currentGameState.NextGameState == NextGameState.CalibrationMode)
            {
                currentGameState = new CalibrationMode(game);
            }

            nextGameState = currentGameState.NextGameState;

            //if the current GameState is not the PauseMenu, the saved game is removed
            if (nextGameState != NextGameState.PauseMenu)
            {
                temporaryGameState = null;
            }
        }
    }