private static void HandleCollisions() { for (int i = 0; i < enemies.Count; i++) { for (int j = 0; j < playerBullets.Count; j++) { if (IsColliding(enemies[i], playerBullets[j])) { enemies[i].WasShot(); playerBullets[j].IsExpired = true; } } } for (int i = 0; i < enemies.Count; i++) { if (IsColliding(enemies[i], Player.Instance) && !Player.Instance.IsInvincible) { Player.Instance.Kill(); enemies.ForEach(e => e.Kill()); enemyBullets.ForEach(b => b.Kill()); } } for (int i = 0; i < enemyBullets.Count; i++) { if (IsOutofBound(enemyBullets[i].Position)) { enemyBullets[i].Kill(); } if (IsColliding(enemyBullets[i], Player.Instance) && !Player.Instance.IsInvincible) { Player.Instance.Kill(); enemies.ForEach(e => e.Kill()); enemyBullets.ForEach(b => b.Kill()); } } for (int i = 0; i < items.Count; i++) { if (IsOutofBound(items[i].Position)) { items[i].Kill(); } if (IsColliding(items[i], Player.Instance)) { var type = items[i].Type; switch (type) { case Item.ItemType.Power: Status.AddPower(); break; case Item.ItemType.Life: Status.AddLife(); break; case Item.ItemType.Bomb: Status.AddBomb(); break; } items[i].Kill(); } } }