Guest User

Untitled

a guest
Dec 2nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1.  public class Power
  2.     {
  3.         Color color;
  4.         Texture2D BlankTexture;
  5.         int powerLevel;
  6.         public int PowerLevel
  7.         {
  8.             get { return powerLevel; }
  9.             set {
  10.                 if (value < 20) color = Color.Red;
  11.                 powerLevel = value > 100 ? 100 : value < 0 ? 0 : value; }
  12.         }
  13.  
  14.         public Power(Texture2D texture)
  15.         {
  16.             BlankTexture = texture;
  17.             powerLevel = 0;
  18.             color = new Color(80,80,855);
  19.         }
  20.  
  21.  
  22.         public void Draw(SpriteBatch spritebatch, Vector2 position)
  23.         {
  24.             spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 5, (int)position.Y + 82, 100 + 6, 10 + 4), null, Color.Black);
  25.             spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 6, (int)position.Y + 83, 100 + 4, 10 + 2), null, Color.White);
  26.             spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 7, (int)position.Y + 84, 100 + 2, 10), null, Color.Black);
  27.             spritebatch.Draw(BlankTexture, new Rectangle((int)position.X + 8, (int)position.Y + 85, powerLevel, 10 - 2), null, color);
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment