Beispiel #1
0
 public void CheckVictory(Player player, MainWindow window)
 {
     if (player.Position == Board.Tiles.Length - 1)
     {
         MessageBox.Show("Player " + player.Name + " has won the game!", "GAME OVER");
         window.Close();
     }
 }
 public void TakeTurn(MainWindow window)
 {
     ColorLandGame.TakeTurn(window);
     OnPropertyChanged("ColorLandGame");
 }
Beispiel #3
0
 public void Start(MainWindow window)
 {
     //PopulateDemoGame();
     if (Players[CurTurn] is BotPlayer)
         TakeTurn(window);
 }
Beispiel #4
0
        public void TakeTurn(MainWindow window)
        {
            while (true)
            {
                MakeTurn(Players[CurTurn]);
                CheckVictory(Players[CurTurn], window);
                Players[CurTurn].CurPlayer = "";

                CurTurn++;
                if (CurTurn == Players.Count)
                    CurTurn = 0;

                Players[CurTurn].CurPlayer = "<";

                if (!(Players[CurTurn] is BotPlayer))
                    break;
            }
        }
        public void StartGame(MenuWindow window)
        {
            if(!IsRandomSeed)
                Randomizer.SetSeed(Seed);

            Game game = new Game(new Board(BoardHeight, BoardWidth, (BoardHeight * 20), (BoardWidth * 20)));

            for (int i = 0; i < Players.Count; i++)
            {
                if (Players[i].Name == null)
                    Players[i].Name = GetRandomName(Players[i].IsBot);

                if (Players[i].IsBot)
                    game.AddBot(Players[i].Name);
                else
                    game.AddHuman(Players[i].Name);
            }

            MainWindow mainWindow = new MainWindow(game, (BoardHeight * 20), (BoardWidth * 20));
            mainWindow.Show();
            window.Close();
        }