示例#1
0
 public void Remove(Projectile proj)
 {
     Debug.Assert(proj != null, "Projectile is null.");
     ProjectileList.Remove(proj);
     EntityList.Remove(proj);
     PhysicalObjectList.Remove(proj);
 }
示例#2
0
 public void ProjectilePlayerCollision(Player player)
 {
     foreach (Projectile projectile in ProjectileList)
     {
         if (projectile.HitRect.Intersects(player.HitRect))
         {
             if (player.Damage())
             {
                 player.CurrHealth = (player.CurrHealth - projectile.GetDamage());
             }
             ProjectileList.Remove(projectile);
             return;
         }
     }
 }
示例#3
0
 public void ProjectileNPCCollision(List <NPC> NPCs)
 {
     foreach (Projectile projectile in ProjectileList)
     {
         foreach (NPC npc in NPCs)
         {
             if (projectile.HitRect.Intersects(npc.HitRect) && !npc.IsDead)
             {
                 npc.CurrHealth    -= projectile.GetDamage();
                 npc.IsDamaged      = true;
                 npc.DamageCooldown = 100;
                 ProjectileList.Remove(projectile);
                 return;
             }
         }
     }
 }