public void StartGame() { m_game = new Core.Game(); GameObject button = GameObject.Find("StartButton"); GameObject TextPointToWin = GameObject.Find("TextPointToWin"); GameObject TextKnightLife = GameObject.Find("TextKnightLife"); GameObject TextSamouraiLife = GameObject.Find("TextSamouraiLife"); GameObject TextNbOfKnight = GameObject.Find("TextNbOfKnight"); GameObject TextNbOfSamourai = GameObject.Find("TextNbOfSamourai"); InputField inputfPointToWin = TextPointToWin.GetComponentInChildren <InputField>(); InputField inputfKnightLife = TextKnightLife.GetComponentInChildren <InputField>(); InputField inputfSamouraiLife = TextSamouraiLife.GetComponentInChildren <InputField>(); InputField inputfNbOfKnight = TextNbOfKnight.GetComponentInChildren <InputField>(); InputField inputfNbOfSamourai = TextNbOfSamourai.GetComponentInChildren <InputField>(); m_game.GameConfiguration.SetItemValue("PointToWin", inputfPointToWin.text); m_game.GameConfiguration.SetItemValue("KnightStamina", inputfKnightLife.text); m_game.GameConfiguration.SetItemValue("SamouraiStamina", inputfSamouraiLife.text); m_game.GameConfiguration.SetItemValue("Team[0].KnightCount", inputfNbOfKnight.text); m_game.GameConfiguration.SetItemValue("Team[1].SamouraiCount", inputfNbOfSamourai.text); m_game.Initialize(); button.SetActive(false); TextPointToWin.SetActive(false); TextKnightLife.SetActive(false); TextSamouraiLife.SetActive(false); TextNbOfKnight.SetActive(false); TextNbOfSamourai.SetActive(false); }
static void Main() { Log.Info("Starting"); ResultList = new List<RunResult>(); var p1 = new AiPlayer("TimWinBot"); var p2 = new AiPlayer("JimTieBot"); const int maxCount = 1000000; Console.CursorTop = 3; Game game = null; for (var i = 0; i < maxCount; i++) { DrawProgressBar(i, maxCount - 1, '#', ""); var time = new Stopwatch(); time.Start(); if (game == null) { game = new Game(p1, p2); } else { game.Reset(); } var g = game; g.Start(); while (game.Status == GameStatus.Running) Thread.Sleep(1); while (game.ReadyForReset == false) Thread.Sleep(1); time.Stop(); var oldColor = Console.ForegroundColor; if (game.WinStatus == GameWinStatus.Win) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("[{0}ms] {1} - {2}", time.ElapsedMilliseconds, game.WinStatus, game.Winner); Console.ForegroundColor = oldColor; } else { Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("[{0}ms] {1} - ", time.ElapsedMilliseconds, game.WinStatus); Console.ForegroundColor = oldColor; } ResultList.Add(new RunResult(game.Winner, game.WinStatus, time.ElapsedMilliseconds)); TotalCount++; } if(game!= null) game.Dispose(); Console.SetCursorPosition((Console.WindowWidth / 2) - 2, Console.WindowHeight - 2); Console.WriteLine("Done"); Console.ReadKey(); Log.Info("Stopping"); }