public override void makePlay(int iPlayerIndex) { Console.Clear(); //make variable for player Player player = Board.access().getPlayer(iPlayerIndex); //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", playerPrompt(iPlayerIndex)); Console.ReadLine(); //move player player.move(); //Display making move Console.WriteLine("*****Move for {0}:*****", player.getName()); //Display rolling Console.WriteLine("{0}{1}\n", playerPrompt(iPlayerIndex), player.diceRollingToString()); Property propertyLandedOn = Board.access().getProperty(player.getLocation()); //landon property and output to console Console.WriteLine(propertyLandedOn.landOn(ref player)); //Display player details Console.WriteLine("\n{0}{1}", playerPrompt(iPlayerIndex), player.BriefDetailsToString()); //display player choice menu displayPlayerChoiceMenu(player); }
public void test_PlayerGettersAndSetters() { Banker theTestBanker = new Banker(); Player theTestPlayer = new Player(); //hasRolledDoubles bool theTestPlayer.get_hasRolledDoubles(); theTestPlayer.is_hasRolledDoubles(); theTestPlayer.hasRolledDoubles = true; theTestPlayer.not_hasRolledDoubles(); //paidFine bool theTestPlayer.getPaidFine(); theTestPlayer.isPaidFine(); theTestPlayer.notPaidFine(); //landedInJailByThreeStraightDoubles bool theTestPlayer.get_LandedInJailByThreeStraightDoubles(); theTestPlayer.not_LandedInJailByThreeStraightDoubles(); theTestPlayer.is_LandedInJailByThreeStraightDoubles(); //inJail bool theTestPlayer.getJailStats(); theTestPlayer.setIsInJail(); theTestPlayer.setNotInJail(); //lastMove int theTestPlayer.getLastMove(); theTestPlayer.getLocation(); theTestPlayer.getName(); theTestPlayer.getPropertiesOwned(); theTestPlayer.getBalance(); theTestPlayer.getBalance(); theTestPlayer.hasRolledDoublesInJail(); theTestPlayer.isNotActive(); theTestPlayer.get_firstTurnInJail(); theTestPlayer.not_firstTurnInJail(); }