Exemplo n.º 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(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateGray, 1.0f, 0);
            SetupRendering();

            farseerManager.DrawPhysicsObjects(ref farseerView);

            // Draw sprites in farseer-space
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, RasterizerState.CullNone, null, spriteBatchTransformation);

            ragdollManager.Draw(spriteBatch); // this will draw equipment effects
            powerupManager.Draw(spriteBatch); // this draws pickups
            hazardManager.Draw(spriteBatch);  // this draws laser beams
            particleEffectManager.Draw(spriteBatchTransformation);

            spriteBatch.End();


            // Draw sprites in screen-space
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            toolbox.Draw(spriteBatch);
            farseerManager.DrawFrontEffects(spriteBatch);
            objectiveManager.Draw(spriteBatch);

            spriteBatch.End();



            base.Draw(gameTime);
        }
Exemplo n.º 2
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);
        }