PGCGame.Ship.Kill C# (CSharp) Method

Kill() public method

public Kill ( bool brutally ) : void
brutally bool
return void
        public void Kill(bool brutally)
        {
            this.CurrentHealth = brutally ? int.MinValue : 0;
        }

Usage Example

Ejemplo n.º 1
0
 private void processShrinkBullets(Ship ship)
 {
     foreach (Bullet b in ShrinkRayBullets)
     {
         b.Color = Color.Purple;
         b.DoSpeedPlus();
         b.MaximumDistance = new Vector2(875);
         if (b.MaximumDistance.HasValue)
         {
             if (b.TraveledDistance.LengthSquared() >= b.MaximumDistance.Value.LengthSquared())
             {
                 b.IsDead = true;
                 FireKilledEvent();
             }
         }
         if (!b.IsDead && b.Intersects(ship))
         {
             if (ship.ShrinkCount < MaxShrinks)
             {
                 ship.Scale *= .66f;
                 ship.ShrinkCount++;
             }
             if (ship.CurrentHealth > 1)
             {
                 ship.CurrentHealth = (ship.CurrentHealth * .66f).Round();
             }
             else
             {
                 //Ship is at 1 health - MURDER IT!!!!
                 ship.Kill(true);
             }
             b.IsDead = true;
             FireKilledEvent();
         }
     }
 }