示例#1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(31, 31, 31));

            spriteBatch.Begin();

            switch (_state)
            {
            case CGameState.MainScreen:
                _mainscreen.Draw(spriteBatch);
                break;

            case CGameState.CreditsScreen:
                _creditsScreen.Draw(spriteBatch);
                break;

            case CGameState.Playing:
                _background_manager.Draw(spriteBatch);
                _portal_manager.Draw(spriteBatch);
                _bullet_manager.Draw(spriteBatch);
                _enemy_managers.Values
                .ToList()
                .ForEach(x => x.Draw(spriteBatch));
                _player.Draw(spriteBatch);
                _energy_storage_manager.Draw(spriteBatch);
                _bullet_hits_enemy.Draw(spriteBatch);
                _powerup_manager.Draw(spriteBatch);

                break;

            case CGameState.Gameover:
                _gameoverscreen.Draw(spriteBatch);
                break;
            }

            spriteBatch.End();


            base.Draw(gameTime);
        }