public virtual void DrawName(DrawBatch drawBatch, float scale) { Vector2 measurements = (Game1.fontDebug.MeasureString(item.name) * scale); float depth = DrawBatch.CalculateDepth(PositionXY); drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)(position.X - measurements.X / 2), (int)(position.Y + 20 - position.Z - measurements.Y / 2), (int)measurements.X, (int)measurements.Y), Color.DarkBlue, depth); drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, item.name, Game1.fontDebug, new Vector2(position.X, position.Y + 20 - position.Z), scale, 0f, measurements / 2, Color.White, depth); }
public override void Draw(DrawBatch drawBatch) { if (SelectionHandler.selectedID == ID) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Blue, DrawBatch.CalculateDepth(PositionXY)); } else if (tag == Tag.Enemy) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Red, DrawBatch.CalculateDepth(PositionXY)); } else if (tag == Tag.Player) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.White, DrawBatch.CalculateDepth(PositionXY)); } drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, GetCurrentHealth().ToString(), Game1.fontDebug, PositionXY - new Vector2(10), Color.Red, DrawBatch.CalculateDepth(PositionXY)); healthBar.drawRectangle = new Rectangle((int)(position.X - 16), (int)(position.Y + 10), 32, 8); healthBar.Draw(DrawBatch.DrawCall.Tag.GameObject, drawBatch, DrawBatch.CalculateDepth(PositionXY), (short)2, 0f); //collider.Draw(spriteBatch, 2f, Color.Cyan); }