public override void makePlay(int iPlayerIndex) { //Creates variable for player Player player = Board.access().getPlayer(iPlayerIndex); //Created variable for Game Menus GameMenus menu = new GameMenus(); //Created variable for PlayerInput PlayerInput input = new PlayerInput(); //Change the colour for the player Console.ForegroundColor = this.colors[iPlayerIndex]; //if inactive skip turn if (player.isNotActive()) { Console.WriteLine("\n{0} is inactive.\n", player.getName()); //check players to continue //check that there are still two players to continue int activePlayerCount = 0; foreach (Player p in Board.access().getPlayers()) { //if player is active if (!p.isNotActive()) //increment activePlayerCount activePlayerCount++; } //if less than two active players display winner if (activePlayerCount < 2) { this.printWinner(); } return; } //prompt player to make move Console.WriteLine("{0}Your turn. Press Enter to make move", input.playerPrompt(iPlayerIndex)); Console.ReadLine(); //move player player.move(); if (player.getInJail() == false) { //Display making move Console.WriteLine("*****Move for {0}:*****", player.getName()); //Display rolling Console.WriteLine("{0}{1}\n", input.playerPrompt(iPlayerIndex), player.diceRollingToString()); player.setLocation(player.getLocation() + player.getIMoveDistance()); Property propertyLandedOn = Board.access().getProperty(player.getLocation()); //landon property and output to console Console.WriteLine(propertyLandedOn.landOn(ref player)); player.checkLandOnChance(ref player); player.checkLandOnCommunity(ref player); // Checks if the player has either landed on the "Go to Jail" board tile, or has received a "Go to Jail" chance or community chest card // If yes, player's turn ends if (player.checkSentToJail()) { return; } //Display player details Console.WriteLine("\n{0}{1}", input.playerPrompt(iPlayerIndex), player.BriefDetailsToString()); // Checks if the player has landed on the Jail board tile, but has not been sent to Jail if ((player.getLocation() == 10) && (player.getInJail() == false)) { Console.WriteLine("{0} is visiting jail", player.getName()); menu.displayGameMenu(player); } // If player has not landed on Jail board tile, display player choice menu else if (player.getLocation() != 10) { menu.displayGameMenu(player); } // Only other possibility is player is in Jail, not visiting else { menu.displayJailMenu(player); } } else if (player.getInJail()) { menu.displayJailMenu(player); } }
public override void initializeGame() { GameMenus menu = new GameMenus(); this.displayMainMenu(); }