/// <summary> /// Makes the object draw itself. /// </summary> /// <param name="sb"><see cref="ISpriteBatch"/> the object can use to draw itself with.</param> public void Draw(ISpriteBatch sb) { // Ensure the sprite is set if (!IsSpriteSet()) { return; } // Pre-drawing if (BeforeDraw != null) { BeforeDraw.Raise(this, EventArgsHelper.Create(sb)); } // Draw if (IsVisible) { HandleDraw(sb); } // Post-drawing if (AfterDraw != null) { AfterDraw.Raise(this, EventArgsHelper.Create(sb)); } }
/// <summary> /// Makes the object draw itself. /// </summary> /// <param name="sb"><see cref="ISpriteBatch"/> the object can use to draw itself with.</param> public void Draw(ISpriteBatch sb) { if (BeforeDraw != null) { BeforeDraw.Raise(this, EventArgsHelper.Create(sb)); } var drawPos = DrawPosition; _lastScreenPosition = drawPos - Parent.Camera.Min; if (IsVisible) { // Draw the character body _characterSprite.Draw(sb, drawPos, Heading, Color); // Draw the HP/MP DrawSPBar(sb, HPPercent, 0, new Color(255, 0, 0, 175)); DrawSPBar(sb, MPPercent, 1, new Color(0, 0, 255, 175)); // Draw the name DrawName(sb, NameFont); } if (AfterDraw != null) { AfterDraw.Raise(this, EventArgsHelper.Create(sb)); } }
/// <summary> /// Draws the ItemEntity. /// </summary> /// <param name="sb"><see cref="ISpriteBatch"/> to draw to.</param> /// <param name="pos">Position to draw at.</param> /// <param name="color">The color to draw the item.</param> /// <exception cref="ArgumentNullException"><paramref name="sb" /> is <c>null</c>.</exception> public void Draw(ISpriteBatch sb, Vector2 pos, Color color) { if (sb == null) { throw new ArgumentNullException("sb"); } if (BeforeDraw != null) { BeforeDraw.Raise(this, EventArgsHelper.Create(sb)); } if (IsVisible) { if (_grh != null) { _grh.Draw(sb, pos, color); } } if (AfterDraw != null) { AfterDraw.Raise(this, EventArgsHelper.Create(sb)); } }
/// <summary> /// Makes the object draw itself. /// </summary> /// <param name="sb"><see cref="ISpriteBatch"/> the object can use to draw itself with.</param> public void Draw(ISpriteBatch sb) { if (BeforeDraw != null) { BeforeDraw.Raise(this, EventArgsHelper.Create(sb)); } if (IsVisible) { HandleDrawing(sb); } if (AfterDraw != null) { AfterDraw.Raise(this, EventArgsHelper.Create(sb)); } }