Ejemplo n.º 1
0
        private void WorldReady(List<WorldObject> worldObjects, GameInfoLoader gameInfoLoader)
        {
            if (worldObjects == null) {
                var alert = new Alert(ControlManager.Manager, "That world has become corrupt!\nPlease choose or create a different world", "Invalid world!");
                ControlManager.Add(alert);
                return;
            }

            var playerList = new Player[_playerCount];
            var i = 0;
            foreach (var tabPage in _tabs.TabPages) {
                if (tabPage == _gameInfoTab) continue;
                var player = playerList[i] = _playerObjectEditors[tabPage].CreateInstance();
                player.Cash = Constants.GameRules.StartingCash;
                player.Gender =
                    Constants.DefaultPlayerInfo.NamesAndColors.First(tuple => tuple.Item2 == player.PlayerColor).Item3;
                player.InitializeContent(Content);
                // Give them their basic car transport
                player.SetTransport(TransportType.Car);
                i++;
            }

            var gameInfo = new GameInfo(worldObjects, playerList, gameInfoLoader.AgeCounterTarget, gameInfoLoader.GameRuleType);
            var level = new Level(gameInfo);
            ScreenManager.AddGameLayer(level);
            ScreenManager.SwapScreens(this, level);
        }