/// <summary>
 /// Initializes a new instance of the <see cref="ExplosionManager"/> class.
 /// </summary>
 /// <param name="soundManager">
 /// The sound manager.
 /// </param>
 /// <param name="randomNumberGenerator">
 /// The random number generator.
 /// </param>
 public ExplosionManager(SoundManager soundManager, IRandomNumberGenerator randomNumberGenerator)
 {
     this.soundManager = soundManager;
     this.randomNumberGenerator = randomNumberGenerator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShotManager"/> class.
 /// </summary>
 /// <param name="resolutionManager">
 /// The resolution manager.
 /// </param>
 /// <param name="soundManager">
 /// The sound manager.
 /// </param>
 public ShotManager(ResolutionManager resolutionManager, SoundManager soundManager)
 {
     this.resolutionManager = resolutionManager;
     this.soundManager = soundManager;
 }
        /// <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();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExplosionManager"/> class.
 /// </summary>
 /// <param name="soundManager">
 /// The sound manager.
 /// </param>
 /// <param name="randomNumberGenerator">
 /// The random number generator.
 /// </param>
 public ExplosionManager(SoundManager soundManager, IRandomNumberGenerator randomNumberGenerator)
 {
     this.soundManager          = soundManager;
     this.randomNumberGenerator = randomNumberGenerator;
 }