public void Remove(Projectile proj) { Debug.Assert(proj != null, "Projectile is null."); ProjectileList.Remove(proj); EntityList.Remove(proj); PhysicalObjectList.Remove(proj); }
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; } } }
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; } } } }