Exemple #1
0
        public int CollidesWith(ShooterShip s)
        {
            int score = 0;
            foreach(ShooterGameObject e in _enemies)
            {
                if(e.GetCollisionBox().Intersects(s.GetCollisionBox()) && !s.IsDying())
                {
                    s.Kill();
                    score += e.Damage();
                }

                if(s.GetShot() != null)
                {
                    if (!e.IsDying())
                    {
                        if (e.GetCollisionBox().Intersects((s.GetShotCollisionBox())))
                        {
                            score += e.Damage();
                            s.KillProjectile();
                        }
                    }
                }
            }
            return score;
        }
Exemple #2
0
 public void CollidesWithProjectiles(ShooterShip s)
 {
     foreach(ShooterProjectile p in _projectiles)
     {
         if(p.GetCollisionBox().Intersects(s.GetCollisionBox()) && !s.IsDying())
         {
             s.Kill();
             _projectiles.RemoveRange(0, _projectiles.Count);
             break;
         }
     }
 }