示例#1
0
        public PlayerHealth(ContentManager Content)
        {
            health = new Health(Content);
            health.healthBarSprite = new Sprite(Content, SpritePath,
                                                Units.GameToPixel(HealthBarSourceX), Units.GameToPixel(HealthBarSourceY),
                                                Units.GameToPixel(HealthBarSourceWidth), Units.GameToPixel(HealthBarSourceHeight));

            health.healthFillSprite = new VaryingWidthSprite(Content, SpritePath,
                                                             Units.GameToPixel(HealthFillSourceX), Units.GameToPixel(HealthFillSourceY),
                                                             Units.GameToPixel(MaxFillWidth), Units.GameToPixel(MaxFillWidth),
                                                             Units.GameToPixel(HealthFillSourceHeight));

            health.damageFillSprite = new VaryingWidthSprite(Content, SpritePath,
                                                             Units.GameToPixel(HealthDamageSourceX), Units.GameToPixel(HealthDamageSourceY),
                                                             Units.GameToPixel(MaxFillWidth), Units.GameToPixel(0),
                                                             Units.GameToPixel(HealthDamageSourceHeight));
            health.healthNumberSprite = NumberSprite.HudNumber(Content, 0, HealthNumberNumDigits);
        }
示例#2
0
 public void Draw(SpriteBatch spriteBatch)
 {
     if (timer.Expired)
     {
         return;
     }
     if (type == NumberType.Damage)
     {
         NumberSprite number = NumberSprite.DamageNumber(Content, val);
         number.LoadNumber();
         number.DrawCentered(spriteBatch, centerX, centerY + offsetY);
     }
     else
     {
         NumberSprite number = NumberSprite.ExperienceNumber(Content, val);
         number.LoadNumber();
         number.DrawCentered(spriteBatch, centerX, centerY + offsetY);
     }
 }
示例#3
0
 public GunExperienceHud(ContentManager Content)
 {
     experienceBarSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(ExperienceBarSourceX), Units.GameToPixel(ExperienceBarSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     levelSprite = new Sprite(Content, SpriteName,
         Units.TileToPixel(LevelSourceX), Units.GameToPixel(LevelSourceY),
         Units.TileToPixel(LevelSourceWidth), Units.GameToPixel(LevelSourceHeight));
     flashSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(FlashSourceX), Units.TileToPixel(FlashSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     fillSprite = new VaryingWidthSprite(Content, SpriteName,
         Units.TileToPixel(FillSourceX), Units.TileToPixel(FillSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), 0,
         Units.GameToPixel(ExperienceBarSourceHeight));
     maxSprite = new Sprite(Content, SpriteName,
         Units.GameToPixel(MaxSourceX), Units.GameToPixel(MaxSourceY),
         Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     flashTimer = new Timer(FlashTime);
     number = NumberSprite.HudNumber(Content, 0, 2);
 }
示例#4
0
 public GunExperienceHud(ContentManager Content)
 {
     experienceBarSprite = new Sprite(Content, SpriteName,
                                      Units.GameToPixel(ExperienceBarSourceX), Units.GameToPixel(ExperienceBarSourceY),
                                      Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     levelSprite = new Sprite(Content, SpriteName,
                              Units.TileToPixel(LevelSourceX), Units.GameToPixel(LevelSourceY),
                              Units.TileToPixel(LevelSourceWidth), Units.GameToPixel(LevelSourceHeight));
     flashSprite = new Sprite(Content, SpriteName,
                              Units.GameToPixel(FlashSourceX), Units.TileToPixel(FlashSourceY),
                              Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     fillSprite = new VaryingWidthSprite(Content, SpriteName,
                                         Units.TileToPixel(FillSourceX), Units.TileToPixel(FillSourceY),
                                         Units.GameToPixel(ExperienceBarSourceWidth), 0,
                                         Units.GameToPixel(ExperienceBarSourceHeight));
     maxSprite = new Sprite(Content, SpriteName,
                            Units.GameToPixel(MaxSourceX), Units.GameToPixel(MaxSourceY),
                            Units.GameToPixel(ExperienceBarSourceWidth), Units.GameToPixel(ExperienceBarSourceHeight));
     flashTimer = new Timer(FlashTime);
     number     = NumberSprite.HudNumber(Content, 0, 2);
 }