Exemplo n.º 1
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     if (Selected)
     {
         itemsquare.Frame = 1;
     }
     else
     {
         itemsquare.Frame = 0;
     }
     spriteBatch.Draw(itemsquare.Texture, new Vector2(camera.CX + X, camera.CY + Y), new Rectangle((itemsquare.Frame + itemsquare.AnimBegin) * itemsquare.SourceWidth, 0, itemsquare.SourceWidth, itemsquare.Texture.Height), Color.White);
     if (sprite != null)
     {
         if (Type == ItemType.Block)
         {
             spriteBatch.Draw(sprite.Texture, new Vector2(camera.CX + X + 8, camera.CY + Y + 8), Color.White);
         }
         else
         {
             spriteBatch.Draw(sprite.Texture, new Vector2(camera.CX + X, camera.CY + Y), Color.White);
         }
         if (Count > 1)
         {
             Universal.DrawStringMore(spriteBatch, font, Convert.ToString(Count), new Vector2(camera.CX + X + 27, camera.CY + Y + 15), Color.White, Align.Right, false);
         }
     }
     spriteBatch.DrawString(font, letter, new Vector2(camera.CX + X + 29, camera.CY + Y + 27), Color.White);
 }
Exemplo n.º 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            Vector2 fontSize = font.MeasureString(Name);

            spriteBatch.Draw(pixel.Texture, new Rectangle((int)(X + 13 - fontSize.X / 2), IntY + sprite.Texture.Height + 2, (int)(fontSize.X + 6), (int)(fontSize.Y)), new Rectangle(1, 1, 1, 1), Color.Black * 0.5f);
            spriteBatch.DrawString(font, Name, new Vector2(X + 16 - fontSize.X / 2, Y + sprite.Texture.Height + 2), Color.White);
            if (HPBarInterval.IsRunning)
            {
                spriteBatch.Draw(pixel.Texture, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, HP, 4), new Rectangle(1, 1, 1, 1), Color.LimeGreen * 0.75f);
                Universal.DrawRectangleOutline(spriteBatch, new Rectangle(IntX + 16 - MaxHP / 2, IntY - 2, MaxHP, 4), Color.DarkGreen);
            }
        }