Beispiel #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(230, 230, 230, 255));

            switch (GameState)
            {
            case GameStateEnum.MainMenu:
                SpriteBatch.Begin();
                GraphicsDevice.Clear(Color.DeepSkyBlue);
                MainMenuManager.Draw();
                break;

            case GameStateEnum.GameActive:
                SpriteBatch.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null,
                                  GamePlayManager.ActiveMap?.Cam.GetTransform());
                GamePlayManager.Draw();
                break;

            case GameStateEnum.HighScoreView:
                SpriteBatch.Begin();
                HighScoreDisplay.Draw();
                break;

            case GameStateEnum.Story:
                SpriteBatch.Begin();
                StoryMode.Draw();
                break;

            case GameStateEnum.GameOver:
                SpriteBatch.Begin();
                GameOverManager.Draw();
                break;

            case GameStateEnum.Pause:
                SpriteBatch.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null,
                                  GamePlayManager.ActiveMap?.Cam.GetTransform());
                GamePlayManager.Draw();
                SpriteBatch.End();
                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
                PauseManager.Draw();
                break;

            case GameStateEnum.MapMaker:
                SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null,
                                  MapMakerManager?.Cam.GetTransform());
                MapMakerManager?.Draw();
                break;

            case GameStateEnum.LevelSelector:
                SpriteBatch.Begin();
                GraphicsDevice.Clear(Color.Purple);
                LevelSelectorManager.Draw();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            ButtonManager.Draw();
            if (GameState == GameStateEnum.GameActive ||
                GameState == GameStateEnum.Pause ||
                GameState == GameStateEnum.GameOver)
            {
                Window.Title = TotalScore.ToString();
            }
            else
            {
                Window.Title = "Nogard the Dragon";
            }

            SpriteBatch.End();

            base.Draw(gameTime);
        }