Пример #1
0
 protected override void UponDeath(int damage, GeneralPed attacker)
 {
     world.SlowDown(3000, 0.2f);
     world.powerUpList.Add(new MoneyPowerUp(this.position, world, (int)Math.Floor(Money * 0.1f)));
     this.DeduceMoney((int)Math.Floor(Money * 0.1f));
     base.UponDeath(damage, attacker);
 }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public Bullet(Vector2 position, Vector2 velocity, int damage, float range, Texture2D pathTexture, List<GeneralPed> potentialTargets, GeneralPed attacker, World world)
        {
            this.position = position;
            this.velocity = velocity;
            this.damage = damage;
            this.range = range;
            this.pathTexture = pathTexture;
            this.potentialTargets = potentialTargets;
            this.attacker = attacker;
            this.world = world;

            hit = false;
            startingPos = position;
        }
Пример #3
0
 public override void TakeDamage(int damage, GeneralPed attacker)
 {
     if (!IsInvincible)
     {
         timeSinceLastDamage = 0;
         timeRegening = 0;
     }
     base.TakeDamage(damage, attacker);
 }
Пример #4
0
 protected override void UponDeath(int damage, GeneralPed attacker)
 {
     Player player = attacker as Player;
     if (player != null)
     {
         player.AddMoney(1);
         player.AddKillCount();
         if (rnd.Next(100) < 11) // zombies have 11% rate to drop power ups
         {
             int shuffle = rnd.Next(100);
             if (shuffle < 55) world.powerUpList.Add(new MoneyPowerUp(this.position, world, rnd.Next(14, 30)));
             else if (shuffle < 75) world.powerUpList.Add(new AmmoPowerUp(this.position, world));
             else if (shuffle < 90) world.powerUpList.Add(new HealthPowerUp(this.position, world));
             else if (shuffle < 96) world.powerUpList.Add(new ShieldPowerUp(this.position, world));
             else world.powerUpList.Add(new RevivePowerUp(this.position, world));
         }
     }
     base.UponDeath(damage, attacker);
 }
Пример #5
0
 private void TriggerDeathBlast(GeneralPed ped, Vector2 origVelocity)
 {
     foreach (Emitter e in world.particleEffects[1])
     {
         e.ReleaseImpulse = origVelocity * 5;
     }
     world.particleEffects[1].Trigger(ped.Position);
 }
Пример #6
0
 /// <summary>
 /// Triggered upon player death
 /// </summary>
 protected virtual void UponDeath(int damage, GeneralPed attacker)
 {
 }
Пример #7
0
 public virtual void TakeDamage(int damage, GeneralPed attacker)
 {
     if (invincibleTime != 0) return;
     if (health > 0 && health - damage <= 0) UponDeath(damage, attacker);
     this.health = (int)MathHelper.Clamp(health - damage, 0f, maxHealth);
 }
Пример #8
0
 public override void TakeDamage(int damage, GeneralPed attacker)
 {
     base.TakeDamage(damage, attacker);
 }
Пример #9
0
 protected override void UponDeath(int damage, GeneralPed attacker)
 {
     Player player = attacker as Player;
     if (player != null)
     {
         player.AddMoney(20);
         player.AddKillCount();
         if (random.Next(100) < 80) // evil cowboys have 80% rate to drop power ups
         {
             int shuffle = random.Next(100);
             if (shuffle < 25) world.powerUpList.Add(new MoneyPowerUp(this.position, world, 120));
             else if (shuffle < 90) world.powerUpList.Add(new AmmoPowerUp(this.position, world));
             else world.powerUpList.Add(new RevivePowerUp(this.position, world));
         }
         this.GunsOwned[GunEquipped].Dispose();  // Dispose current gun to prevent infinite reload loop
     }
     base.UponDeath(damage, attacker);
 }
Пример #10
0
 public bool IsWithinMap(GeneralPed ped)
 {
     return !(ped.Position.X < 0 || ped.Position.X > WorldSize.X || ped.Position.Y < 0 || ped.Position.Y > WorldSize.Y);
 }
Пример #11
0
 public bool IsMuchOutside(GeneralPed ped)
 {
     // calculate the distance to middle of the map
     Vector2 distance = (ped.Position - WorldSize / 2);
     if (distance.Length() > 20000) return true;
     else return false;
 }