/// <summary>
 /// Initializes a new instance of the <see cref="CollisionManager"/> class.
 /// </summary>
 /// <param name="asteroidManager">
 /// The asteroid manager.
 /// </param>
 /// <param name="playerManager">
 /// The player manager.
 /// </param>
 /// <param name="enemyManager">
 /// The enemy manager.
 /// </param>
 /// <param name="explosionManager">
 /// The explosion manager.
 /// </param>
 /// <param name="shotManager">
 /// The shot manager.
 /// </param>
 public CollisionManager(
     AsteroidManager asteroidManager, 
     PlayerManager playerManager, 
     EnemyManager enemyManager, 
     ExplosionManager explosionManager, 
     ShotManager shotManager)
 {
     this.asteroidManager = asteroidManager;
     this.playerManager = playerManager;
     this.enemyManager = enemyManager;
     this.explosionManager = explosionManager;
     this.shotManager = shotManager;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="EnemyManager"/> class.
        /// </summary>
        /// <param name="randomNumberGenerator">
        /// The random number generator.
        /// </param>
        /// <param name="shotManager">
        /// The shot manager.
        /// </param>
        /// <param name="playerManager">
        /// The player manager.
        /// </param>
        /// <param name="isHost">
        /// The is host.
        /// </param>
        public EnemyManager(
            IRandomNumberGenerator randomNumberGenerator, 
            ShotManager shotManager, 
            PlayerManager playerManager, 
            bool isHost)
        {
            this.isHost = isHost;
            this.randomNumberGenertor = randomNumberGenerator;
            this.shotManager = shotManager;
            this.playerManager = playerManager;

            this.SetUpWaypoints();

            this.isActive = true;
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            this.networkManager.Connect();

            var randomNumberGenerator = new MersenneTwister();
            this.inputManager = new InputManager(this, this.resolutionManager);

            this.soundManager = new SoundManager(randomNumberGenerator);
            this.shotManager = new ShotManager(this.resolutionManager, this.soundManager);
            this.shotManager.ShotFired += (sender, e) => this.networkManager.SendMessage(new ShotFiredMessage(e.Shot));

            this.asteroidManager = new AsteroidManager(this.resolutionManager, randomNumberGenerator, this.IsHost);
            if (this.IsHost)
            {
                this.asteroidManager.AsteroidStateChanged +=
                    (sender, e) => this.networkManager.SendMessage(new UpdateAsteroidStateMessage(e.Asteroid));
            }

            this.playerManager = new PlayerManager(
                this.resolutionManager, randomNumberGenerator, this.inputManager, this.shotManager, this.IsHost);
            this.playerManager.PlayerStateChanged +=
                (sender, e) => this.networkManager.SendMessage(new UpdatePlayerStateMessage(e.Player));

            this.enemyManager = new EnemyManager(
                randomNumberGenerator, this.shotManager, this.playerManager, this.IsHost);
            if (this.IsHost)
            {
                this.enemyManager.EnemySpawned +=
                    (sender, e) => this.networkManager.SendMessage(new EnemySpawnedMessage(e.Enemy));
            }

            this.explosionManager = new ExplosionManager(this.soundManager, randomNumberGenerator);
            this.collisionManager = new CollisionManager(this.asteroidManager, this.playerManager, this.enemyManager, this.explosionManager, this.shotManager);

            this.Components.Add(this.inputManager);

            base.Initialize();
        }