public static void ApplyHealthPowerup(Vehicle vehicle, HealthPowerup powerup) { vehicle.HitPoints = vehicle.HitPoints + (int)((double)vehicle.MaxHitPoints * powerup.Value); }
protected virtual void CreateNextPowerup() { this.powerupIntervalCount = 0; int random = Randomizer.Random.Next(0, 100); Powerup powerup = null; if (random > 88) { powerup = new BurstPowerup(this.simulator); } else if (random > 75) { if (this.game.Player.HasLlama) { this.CreateNextPowerup(); return; } powerup = new LlamaGunPowerup(this.simulator); } else if (random > 63) { powerup = new RateOfFirePowerup(this.simulator); } else if (random > 50) { if (this.game.Player.HasUzi) { this.CreateNextPowerup(); return; } powerup = new UziPowerup(this.simulator); } else if (random > 38) { powerup = new DamagePowerup(this.simulator); } else if (random > 25) { powerup = new MaxHealthPowerup(this.simulator); } else if (random > 12) { powerup = new HealthPowerup(this.simulator); } else { powerup = new AccuracyPowerup(this.simulator); } float x = (float)Randomizer.Random.Next(100, Screen.Width - 100); powerup.Position = new Vector2(x, 100); this.RegisterPowerup(powerup); }