/// <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(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); spaceManager.Draw(spriteBatch); switch (gameState) { case GameState.MainMenu: menuManager.Draw(spriteBatch); break; case GameState.Gameplay: sunManager.Draw(spriteBatch); orbitManager.Draw(spriteBatch); planetManager.Draw(spriteBatch); asteroidManager.Draw(spriteBatch, sunManager); scoreManager.Draw(spriteBatch); break; case GameState.Credits: creditManager.Draw(spriteBatch); break; } spriteBatch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { Vector4 shipColor = new Vector4(0.5f + ((float)bulletManager.justShot / 15f), 0.5f, 0.5f, 1); Game1.texNorm.Parameters["shipColor"].SetValue(shipColor); Game1.texNorm.Parameters["shipLight"].SetValue(35 + bulletManager.justShot * 2); Game1.texNorm.Parameters["shipPos"].SetValue(Player.get().Position); Game1.texNorm.Parameters["vpMatrix"].SetValue(theCamera.ViewMatrix * theCamera.ProjectionMatrix); Game1.texNorm.Parameters["wallLight"].SetValue(200); Game1.texNorm.Parameters["wallColor"].SetValue(Color.Orange.ToVector4()); asteroidManager.Draw(gameTime); skybox.Draw(gameTime); tunnel.Draw(gameTime); player.Draw(gameTime); bulletManager.Draw(gameTime); pgen.Draw(gameTime); // Draw all game components base.Draw(gameTime); if (gameOver) { // TO DO: Draw the "gameover" text String TextToDraw = "Game Over!"; spriteBatch.DrawString(gameOverFont, TextToDraw, new Vector2((Game.Window.ClientBounds.Width - 250) / 2, (Game.Window.ClientBounds.Height - 250) / 2), Color.Yellow); } }
public void Draw(SpriteBatch spriteBatch) { cloudManager.Draw(spriteBatch); starManager.Draw(spriteBatch); itemManager.Draw(spriteBatch); crateManager.Draw(spriteBatch); asteroidManager.Draw(spriteBatch); strandedManager.Draw(spriteBatch); particleManager.Draw(spriteBatch); projectileManager.Draw(spriteBatch); playerManager.Draw(spriteBatch); guiManager.Draw(spriteBatch); debugManager.Draw(spriteBatch); }
protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); if (gameState == GameStates.TitleScreen) { spriteBatch.Draw(titleScreen, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), Color.White); } if ((gameState == GameStates.Playing) || (gameState == GameStates.PlayerDead) || (gameState == GameStates.GameOver)) { starField.Draw(spriteBatch); asteroidManager.Draw(spriteBatch); playerManager.Draw(spriteBatch); enemyManager.Draw(spriteBatch); explosionManager.Draw(spriteBatch); spriteBatch.DrawString(pericles14, "Score: " + playerManager.PlayerScore.ToString(), scoreLocation, Color.Yellow); if (playerManager.LivesRemaining >= 0) { spriteBatch.DrawString(pericles14, "Lives: " + playerManager.LivesRemaining.ToString(), livesLocation, Color.Yellow); } } if (gameState == GameStates.GameOver) { spriteBatch.DrawString(pericles14, "G A M E O V E R", new Vector2(Window.ClientBounds.Width / 2 - pericles14.MeasureString("G A M E O V E R").X / 2, 50), Color.Red); } spriteBatch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { _starField.Draw(gameTime, spriteBatch); _asteroidManager.Draw(gameTime, spriteBatch); _player.Draw(gameTime, spriteBatch); _shotManager.Draw(gameTime, spriteBatch); _enemyManager.Draw(gameTime, spriteBatch); _pieceExplosionManager.Draw(gameTime, spriteBatch); _pointExplosionManager.Draw(gameTime, spriteBatch); spriteBatch.DrawString(_perecles14, "Score " + _playerScore, _scoreLocation, Color.White); if (_player.RemainingLives > 0) { spriteBatch.DrawString(_perecles14, "Ships Remaining: " + _player.RemainingLives, _livesLocation, Color.White); } if (_gameOver) { const string GameOverText = "G A M E O V E R !"; Vector2 loc = new Vector2(ClientBounds.Width / 2 - _perecles14.MeasureString(GameOverText).X / 2, 50); spriteBatch.DrawString(_perecles14, GameOverText, loc, Color.White); } }