Exemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                menuManager.ExitGame)
            {
                this.Exit();
            }

            if (InputManager.IsKeyReleased(Keys.Escape) && InputManager.MouseInBounds)
            {
                if (TileGrid.GameState == GameStates.Playing)
                {
                    menuManager.QuitGame();
                    TileGrid.GameState = GameStates.QuitGame;
                }
                else if (TileGrid.GameState == GameStates.QuitGame)
                {
                    TileGrid.GameState = GameStates.Playing;
                }
            }

            InputManager.Update(gameTime);
            resolutionManager.Update(gameTime);

            switch (TileGrid.GameState)
            {
            case GameStates.Menu:
                menuManager.Update(gameTime);
                break;

            case GameStates.Lobby:
                networkingManager.Update(gameTime);
                menuManager.Update(gameTime);
                break;

            case GameStates.StartNewGame:
                tileManager.OnPlayGame(true);
                networkingManager.Update(gameTime);
                tileManager.NewGame();
                break;

            case GameStates.QuitGame:
                menuManager.Update(gameTime);
                networkingManager.Update(gameTime);
                break;

            case GameStates.Playing:
                cameraManager.Update(gameTime);
                tileManager.Update(gameTime);
                networkingManager.Update(gameTime);
                animationManager.Update(gameTime);
                break;
            }
            screenshotManager.Update(gameTime);
            bannerManager.Update(gameTime);
            fpsMonitor.Update(gameTime);
            base.Update(gameTime);
        }