예제 #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);
                    }
                }
            }
        }