예제 #1
0
 private void checkShotToEnemyCollisions()
 {
     foreach (Sprite shot in playerManager.PlayerShotManager.Shots)
     {
         foreach (Enemy enemy in enemyManager.Enemies)
         {
             if (shot.IsCircleColliding(
                     enemy.EnemySprite.Center,
                     enemy.EnemySprite.CollisionRadius))
             {
                 shot.Location              = offScreen;
                 enemy.Destroyed            = true;
                 playerManager.PlayerScore += enemyPointValue;
                 explosionManager.AddExplosion(
                     enemy.EnemySprite.Center,
                     enemy.EnemySprite.Velocity / 10);
             }
         }
     }
 }
예제 #2
0
 private void checkShotToPlayerCollisions()
 {
     foreach (Sprite shot in enemyManager.EnemyShotManager.Shots)
     {
         if (shot.IsCircleColliding(
                 playerManager.playerSprite.Center,
                 playerManager.playerSprite.CollisionRadius))
         {
             shot.Location           = offScreen;
             playerManager.Destroyed = true;
             explosionManager.AddExplosion(
                 playerManager.playerSprite.Center,
                 Vector2.Zero);
         }
     }
 }