Exemplo n.º 1
0
 protected void CreatScreens()
 {
     startMenu = new StartMenu(this, menuFont);
     gameScreen = new GameScreen(this);
     endScreen = new EndScreen(this, menuFont);
 }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            KeyboardState keyboardState = Keyboard.GetState();
            switch (CurrentState)
            {
                case GameState.StartMenu:
                    startMenu.Update(keyboardState, prevKeyState);
                    break;

                case GameState.HighScore:

                    break;

                case GameState.GameScreen:
                    gameScreen.Update(gameTime);
                    break;
                case GameState.LevelEditor:

                    break;
                case GameState.EndScreen:
                    endScreen.Update();
                    if (endScreen.ChangeScreen())
                    {
                        gameScreen = new GameScreen(this);
                        gameScreen.Load();
                        CurrentState = GameState.StartMenu;
                        endScreen.Init();
                    }
                    break;

            }
            prevKeyState = keyboardState;

            base.Update(gameTime);
        }