private void localGame1v1_button_Click(object sender, RoutedEventArgs e) { boardGameGUI gameWindow = new boardGameGUI(); gameWindow.Show(); gameWindow.updateGUI(this.boardGame); }
public void createGame() { List <Player> players = new List <Player>(); List <Pit> pits1 = createPits(); //player1 = new Player(97, "Jux", pits1); AI p1 = new AI(97, "JUX", pits1, null); player1 = p1; players.Add(player1); List <Pit> pits2 = createPits(); //player2 = new Player(107, "Cécile", pits2); player2 = new AI(107, "Cécile", pits2, player1); players.Add(player2); this.Players = players; p1.Adversary = player2; gameEngine = new GameEngine(this, player1, player2); //Who start the game with a random /* Random rand = new Random(); * if (rand.Next(0, 2) == 0) * { * gameEngine = new GameEngine(this, player1, player2); * } * else * { * gameEngine = new GameEngine(this, player2, player1); * } */ boardGameGUI gameWindow = new boardGameGUI(); gameWindow.Show(); System.Threading.Thread.Sleep(1000); Thread thread = new Thread(() => gameEngine.launchGame()); thread.Start(); gameEngine.launchGame(); gameWindow.updateGUI(this); }