/// <summary>Рисуем</summary> /// <param name="spriteBatch">The sprite batch.</param> public override void Draw(SpriteBatch spriteBatch) { //Здание Sprite.Draw(spriteBatch, Rect); //Подпись var health = CurrentResource.ToString() + "/" + MaxResource.ToString(); Vector2 FontOrigin = Font.MeasureString(health) / 2; var signatureRect = new Rectangle(Rect.X + Rect.Width / 2 - Signature.Width / 2, Rect.Y + Rect.Height - Signature.Height, Signature.Width, Signature.Height); Signature.Draw(spriteBatch, signatureRect); spriteBatch.DrawString(Font, health, new Vector2(signatureRect.Right - signatureRect.Width / 2, signatureRect.Bottom - signatureRect.Height / 2), Color.Black, 0, FontOrigin, 1, SpriteEffects.None, 1); //Кнопка апдейта if (Owner != null && Owner.Type == PlayerType.Human && _Level != _MaxLevel && !_StartUpdate) { spriteBatch.Draw(_Upgrade, new Vector2(Rect.X + 10, Rect.Y + 10)); } //Селекторы if (DrawEnemySelector) { spriteBatch.Draw(EnemySelector, Rect, Color.White); } else if (DrawOurSelector) { spriteBatch.Draw(OurSelector, Rect, Color.White); } }
public override void Draw(SpriteBatch spriteBatch) { //Здание Sprite.Draw(spriteBatch, Rect); //Подпись var health = CurrentResource.ToString() + "/" + MaxResource.ToString(); Vector2 FontOrigin = Font.MeasureString(health) / 2; var signatureRect = new Rectangle(Rect.X + Rect.Width / 2 - Signature.Width / 2, Rect.Y + Rect.Height - Signature.Height, Signature.Width, Signature.Height); Signature.Draw(spriteBatch, signatureRect); spriteBatch.DrawString(Font, health, new Vector2(signatureRect.Right - signatureRect.Width / 2, signatureRect.Bottom - signatureRect.Height / 2), Color.Black, 0, FontOrigin, 1, SpriteEffects.None, 1); //Селекторы if (DrawEnemySelector) { spriteBatch.Draw(EnemySelector, Rect, Color.White); } else if (DrawOurSelector) { spriteBatch.Draw(OurSelector, Rect, Color.White); } }