/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds; lineBatch.Begin(); // draw all actors foreach (Actor actor in World.Actors) { if (actor.Dead == false) { actor.Draw(elapsedTime, lineBatch); } } lineBatch.End(); DrawHud(elapsedTime); #if ANDROID || IOS GamePad.Draw(gameTime, spriteBatch); #endif // draw the stars spriteBatch.Begin(); World.Starfield.Draw(spriteBatch, starTexture); spriteBatch.End(); // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }
/// <summary> /// Draws the background screen. /// </summary> public override void Draw(GameTime gameTime) { Viewport viewport = ScreenManager.GraphicsDevice.Viewport; Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height); if (ShowParticles) { // Apply bloom to the explosions ScreenManager.BloomComponent.BeginDraw(); lineBatch.Begin(); for (int i = 0; i < particleSystems.Count; i++) { particleSystems[i].Draw(lineBatch); } lineBatch.End(); ScreenManager.BloomComponent.Draw(gameTime); } // title Vector2 titlePosition = new Vector2( (viewportSize.X - titleTexture.Width) / 2f, viewportSize.Y * 0.18f); titlePosition.Y -= (float)Math.Pow(TransitionPosition, 2) * titlePosition.Y; Color titleColor = Color.White; ScreenManager.SpriteBatch.Begin(); ScreenManager.SpriteBatch.Draw(titleTexture, titlePosition, new Color(titleColor.R, titleColor.G, titleColor.B, TransitionAlpha)); ScreenManager.SpriteBatch.End(); }
/// <summary> /// Draws the gameplay screen. /// </summary> public override void Draw(GameTime gameTime) { float elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds; lineBatch.Begin(); // draw all actors foreach (Actor actor in world.Actors) { if (actor.Dead == false) { actor.Draw(elapsedTime, lineBatch); } } // draw all particle systems foreach (ParticleSystem particleSystem in world.ParticleSystems) { if (particleSystem.IsActive) { particleSystem.Draw(lineBatch); } } // draw the walls world.DrawWalls(lineBatch); lineBatch.End(); // draw the stars spriteBatch.Begin(); world.Starfield.Draw(spriteBatch, starTexture); spriteBatch.End(); if (WorldRules.NeonEffect) { bloomComponent.Draw(gameTime); } DrawHud(elapsedTime); #if ANDROID || IOS || WINDOWS_PHONE GamePad.Draw(gameTime, spriteBatch); #endif // If the game is transitioning on or off, fade it out to black. if (TransitionPosition > 0) { ScreenManager.FadeBackBufferToBlack(255 - TransitionAlpha); } }