예제 #1
0
 private static void CheckShotEnemyImpacts(Sprite shot)
 {
     if (shot.Expired)
     {
         return;
     }
     foreach (Enemy enemy in EnemyManager.Enemies)
     {
         if (!enemy.Destroyed)
         {
             if (shot.IsCircleColliding(enemy.EnemyBase.WorldCenter, enemy.EnemyBase.CollisionRadius))
             {
                 shot.Expired       = true;
                 enemy.Destroyed    = true;
                 GameManager.Score += 10;
                 if (shot.Frame == 0)
                 {
                     EffectsManager.AddExplosion(enemy.EnemyBase.WorldCenter, enemy.EnemyBase.Velocity / 30);
                 }
                 else
                 {
                     if (shot.Frame == 1)
                     {
                         CreateLargeExplosion(shot.WorldCenter);
                         CheckRocketSplashDamage(shot.WorldCenter);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        private static void CheckRocketSplashDamage(Vector2 location)
        {
            int rocketSplashRadius = 40;

            foreach (Enemy enemy in EnemyManager.Enemies)
            {
                if (!enemy.Destroyed)
                {
                    if (enemy.EnemyBase.IsCircleColliding(location, rocketSplashRadius))
                    {
                        enemy.Destroyed    = true;
                        GameManager.Score += 10;
                        EffectsManager.AddExplosion(enemy.EnemyBase.WorldCenter, Vector2.Zero);
                    }
                }
            }
        }