private void InitializeShips() { ShipFactory.RemoveList(this.DeadShipList); if (JoinedPlayerManager.JoinedPlayers.Count == 0) { var player = new JoinedPlayer(); player.InputDevice = InputManager.Keyboard; player.ShipType = ShipType.Gray; JoinedPlayerManager.JoinedPlayers.Add(player); } #if DEBUG if (DebuggingVariables.CreateExtraShips) { var player = new JoinedPlayer(); player.InputDevice = InputManager.Xbox360GamePads[2]; player.ShipType = ShipType.RedStripes; JoinedPlayerManager.JoinedPlayers.Add(player); } #endif int index = 0; foreach (var player in JoinedPlayerManager.JoinedPlayers) { var ship = ShipFactory.CreateNew(); ship.RotationZ = MathHelper.ToRadians(90); ship.SetTeam(index); ship.SetSail(player.ShipType.ToSailColor()); ship.InitializeRacingInput(player.InputDevice); ship.AfterDying += ReactToShipDying; ship.BulletHit += ReactToBulletHit; // create local var: var shipIndex = index; ship.BulletShot += () => CameraControllerList[shipIndex].DoShake(); index++; } }