Beispiel #1
0
        public GameController()
        {
            string textInput = "default";
            int    intInput;

            Repo          = new GameRepo();
            Arena         = new ArenaBattleCalculator();
            PlayerManager = new PlayerManager();

            Repo.FileSetup();
            StaticUtility.TalkPause("Welcome to the Isle of Dr. Mangle.");
            if (Repo.gameIndex.Count > 1)
            {
                Data = Repo.LoadGame();
            }
            if (Data == null)
            {
                bool halt = true;
                while (halt)
                {
                    Console.WriteLine("Please enter a name for your game data:");
                    textInput = Console.ReadLine();
                    if (Repo.gameIndex.ContainsKey(textInput))
                    {
                        Console.WriteLine("A game by that name already exists.");
                    }
                    else
                    {
                        halt = false;
                    }
                }
                Console.WriteLine("And how many contestants will you be competing against?");
                intInput = StaticUtility.CheckInput(1, 7);
                Data     = new GameData(textInput, intInput, Repo.GetNextGameID(), RNG);
                Repo.SaveGame(Data);
            }
            AllPlayers    = new PlayerData[Data.AiPlayers.Length + 1];
            AllPlayers[0] = Data.CurrentPlayer;
            for (int i = 0; i < Data.AiPlayers.Length; i++)
            {
                AllPlayers[i + 1] = Data.AiPlayers[i];
            }
        }
Beispiel #2
0
 public GameController(bool forTest)
 {
     Arena         = new ArenaBattleCalculator();
     PlayerManager = new PlayerManager();
 }