public virtual void Draw(Vector2 a_offset) { Engine.Globals.NormalEffect.Parameters["xSize"].SetValue(1.0f); Engine.Globals.NormalEffect.Parameters["ySize"].SetValue(1.0f); Engine.Globals.NormalEffect.Parameters["xDraw"].SetValue(1.0f); Engine.Globals.NormalEffect.Parameters["yDraw"].SetValue(1.0f); Engine.Globals.NormalEffect.Parameters["filterColor"].SetValue(Color.Black.ToVector4()); Engine.Globals.NormalEffect.CurrentTechnique.Passes[0].Apply(); _barBackground.Draw(a_offset, new Vector2(0, 0), Color.Black); Engine.Globals.NormalEffect.Parameters["filterColor"].SetValue(_color.ToVector4()); Engine.Globals.NormalEffect.CurrentTechnique.Passes[0].Apply(); _bar.Draw(a_offset + new Vector2(_border, _border), new Vector2(0, 0), _color); }
public void Draw(World a_world) { Globals.NormalEffect.Parameters["xSize"].SetValue(1.0f); Globals.NormalEffect.Parameters["ySize"].SetValue(1.0f); Globals.NormalEffect.Parameters["xDraw"].SetValue(1.0f); Globals.NormalEffect.Parameters["yDraw"].SetValue(1.0f); Globals.NormalEffect.Parameters["filterColor"].SetValue(Color.White.ToVector4()); Globals.NormalEffect.CurrentTechnique.Passes[0].Apply(); string displayLine = $"Enemies slain: {a_world._nKilled}"; Vector2 stringDimension = _font.MeasureString(displayLine); Globals.MySpriteBatch.DrawString(_font, displayLine, new Vector2(Globals.ScreenWidth - 300, 100), Color.Black); if (a_world.MainCharacter.Dead) { displayLine = "You died... Press Enter to restart!"; stringDimension = _font.MeasureString(displayLine); Globals.MySpriteBatch.DrawString(_font, displayLine, new Vector2(Globals.ScreenWidth / 2 - (stringDimension.X / 2), Globals.ScreenHeight / 2), Color.Black); _resetButton.Draw(new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight / 2 + 100)); } if (a_world.MainCharacter.Swapping) { displayLine = "" + Convert.ToInt32((a_world.MainCharacter.SwapTimer.MSec - a_world.MainCharacter.SwapTimer.Timer) / 1000 + 1); stringDimension = _font.MeasureString(displayLine); Globals.MySpriteBatch.DrawString(_font, displayLine, new Vector2(a_world.MainCharacter.Position.X, a_world.MainCharacter.Position.Y - a_world.MainCharacter.Dimension.Y / 2 - 35) + a_world.Offset, Color.Black); } _healthBar.Draw(new Vector2(100, 100)); _staminaBar.Draw(new Vector2(300, 100)); if (GameGlobals.paused) { _mainMenuButton.Draw(new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight / 2 + 300)); _pauseOverlay.Draw(Vector2.Zero, Color.Black); } }