public void CollidesWithHostile(Player p) { //Behaviour for Asteroids foreach (Asteroid a in _asteroids) { //Check player + asteroid collision if (SwinGame.CircleTriangleCollision(a.Shape, p.Shape) && p.Collision) { p.Destroy(); } //Check player missle + asteroid collision foreach (Missile playerMissile in p.Missiles._missles) { if (SwinGame.CircleCircleCollision(a.Shape, playerMissile.Shape)) { SwinGame.PlaySoundEffect(SwinGame.SoundEffectNamed("hitEnemy")); a.Active = false; playerMissile.Active = false; playerMissile.AddScore(); } } } //Behaviour for aliens foreach (Alien a in _aliens) { //Check player + alien collision if (SwinGame.CircleTriangleCollision(a.Shape, p.Shape) && p.Collision) { p.Destroy(); } //Check player + alien missiles collision a.Missiles.PlayerCollidesWithMissile(p); //Check player missle + alien collision foreach (Missile playerMissile in p.Missiles._missles) { if (SwinGame.CircleCircleCollision(a.Shape, playerMissile.Shape) && a.Collision) { a.Destroy(); playerMissile.Active = false; playerMissile.AddScore(); } } } }