private static void CheckRocketSplashDamage(Vector2 location)
    {
        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);
                }
            }
        }
    }
    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);
                        }
                    }
                }
            }
        }
    }
Esempio n. 3
0
 private void OnDestroyed()
 {
     _playerCharacter.Score += Value;
     _effectsManager.AddExplosion(_sprite.GetPosition());
 }