private void DrawDiagnosticHitBox(SpriteBatch spriteBatch) { spriteBatch.Begin(); Square hitBox = new Square { Alpha = 0.8f, Color = Color.OrangeRed, Bounds = (Rectangle)BoundingBox.Bounds }; hitBox.Draw(spriteBatch, BoundingBox.Position); Square spriteBox = new Square { Alpha = 0.4f, Color = Color.OrangeRed, Bounds = new Rectangle(0, 0, ContentWidth, ContentHeight) }; spriteBox.Draw(spriteBatch, Position); spriteBatch.End(); }
private void DrawGameOver() { string title = "SIAMO FUORI!"; string legend = "(premere Enter per ricominciare)"; Square square = new Square { Alpha = 0.7f, Bounds = GraphicsDevice.Viewport.Bounds, Color = Color.DarkRed }; spriteBatch.Begin(); square.Draw(spriteBatch); DrawText(title, titleFont, new Vector2(0, -30), Color.BlanchedAlmond); DrawText(legend, regularFont, new Vector2(160, 25), Color.AliceBlue); spriteBatch.End(); }
protected override void Draw(GameTime gameTime) { base.Draw(gameTime); if (!blackOutStart.HasValue || !blackOutDuration.HasValue) { return; } var difference = gameTime.TotalGameTime - blackOutStart.Value; if (difference > blackOutDuration) { blackOutStart = null; blackOutDuration = null; } else { double alpha = 1 - difference.TotalMilliseconds / blackOutDuration.Value.TotalMilliseconds; Square square = new Square { Bounds = GraphicsDevice.Viewport.Bounds, Color = Color.Black, Alpha = (float)Math.Max(0.01, Math.Min(alpha, 1)) }; spriteBatch.Begin(); square.Draw(spriteBatch); spriteBatch.End(); } }