/// <summary> /// Performs the action for the player's new location based on what type of tile it is. /// </summary> /// <param name="player">Current Player</param> private void LocationResponse(Player player) { // if the player lands on a propertym display pay rent or purchase property form if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Basic) || GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Utility) || GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Railroad)) { Property property = (Property)GameLoop.getInstance().Gameboard.TileOrder[player.Location]; DisplayPayRentOrPurchasePropertyForm(player, property); DisplayCurrentPlayerProperties(player); // GUI } // when a player lands on a community chest spot or chance spot else if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(CardSpace)) { // Get the cardSpace and display the community or chance form CardSpace cardTile = (CardSpace)GameLoop.getInstance().Gameboard.TileOrder[player.Location]; DisplayCommunityOrChanceForm(player, cardTile); // if the community or chance card calls for the player to advance to a property, display pay rent or purchase property form if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Basic) || GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Utility) || GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(Railroad))) { DisplayCurrentPlayerMoney(player); DisplayPayRentOrPurchasePropertyForm(player, (Property)GameLoop.getInstance().Gameboard.TileOrder[player.Location]); } // if the community or chance card calls for the player to advance to a card space, display community or chance card form else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(CardSpace))) { DisplayCurrentPlayerMoney(player); DisplayCommunityOrChanceForm(player, (CardSpace)GameLoop.getInstance().Gameboard.TileOrder[player.Location]); } // if the community or chance card calls for the player to advance to the go to jail space, send the player to jail else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(GoToJail))) { GoToJail goToJailTile = (GoToJail)GameLoop.getInstance().Gameboard.TileOrder[player.Location]; goToJailTile.LocationAction(player); } // if the community or chance card calls for the player to advance to the go to Income Tax, decrease the player's money by 10% (if more) or pay $200 else if (cardTile.ProcessedCard[0, 1] == "Advance" && (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(FreeParking))) { FreeParking freeParking = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[player.Location]; PayTaxForm(player, freeParking); } } // if Luxury Tax or Income Tax, display tax form else if (GameLoop.getInstance().Gameboard.TileOrder[player.Location].GetType() == typeof(FreeParking)) { FreeParking freeParking = (FreeParking)GameLoop.getInstance().Gameboard.TileOrder[player.Location]; if (freeParking.Name == "Income Tax" || freeParking.Name == "Luxury Tax") { PayTaxForm(player, freeParking); } } // if not a property or community chest or chance card, call location action on that tile else { GameLoop.getInstance().Gameboard.TileOrder[player.Location].LocationAction(player); } DisplayCurrentPlayerMoney(player); // GUI DisplayCurrentPlayerLocation(player); DisplayCurrentPlayerProperties(player); UpdateBoard(player); }
/// <summary> /// Initializes all the tiles in the game and stores them in order. /// </summary> private void InitializeTileOrder() { _TileOrder = new Tile[40]; _TileOrder[0] = new PassGo(); _TileOrder[1] = new Basic("Mediterranean Avenue", 60, 2); _TileOrder[2] = new CardSpace("Community Chest"); _TileOrder[3] = new Basic("Baltic Avenue", 80, 4); _TileOrder[4] = new FreeParking("Income Tax"); //IncomeTax _TileOrder[5] = new Railroad("Reading Railroad", 200, 25); _TileOrder[6] = new Basic("Oriental Avenue", 100, 6); _TileOrder[7] = new CardSpace("Chance"); _TileOrder[8] = new Basic("Vermont Avenue", 100, 6); _TileOrder[9] = new Basic("Connecticut Avenue", 120, 8); _TileOrder[10] = new Jail(); _TileOrder[11] = new Basic("St. Charles Place", 140, 10); _TileOrder[12] = new Utility("Electric Company", 150, 1); _TileOrder[13] = new Basic("States Avenue", 140, 10); _TileOrder[14] = new Basic("Virginia Avenue", 160, 12); _TileOrder[15] = new Railroad("Pennsylvania Railroad", 200, 25); _TileOrder[16] = new Basic("St. James Place", 180, 14); _TileOrder[17] = new CardSpace("Community Chest"); _TileOrder[18] = new Basic("Tennessee Avenue", 180, 14); _TileOrder[19] = new Basic("New York Avenue", 200, 16); _TileOrder[20] = new FreeParking(); _TileOrder[21] = new Basic("Kentucky Avenue", 220, 18); _TileOrder[22] = new CardSpace("Chance"); _TileOrder[23] = new Basic("Indiana Avenue", 220, 18); _TileOrder[24] = new Basic("Illinois Avenue", 240, 20); _TileOrder[25] = new Railroad("B & O Railroad", 200, 25); _TileOrder[26] = new Basic("Atlantic Avenue", 260, 22); _TileOrder[27] = new Basic("Ventnor Avenue", 260, 22); _TileOrder[28] = new Utility("Water Works", 150, 1); _TileOrder[29] = new Basic("Marvin Gardens", 280, 24); _TileOrder[30] = new GoToJail(); _TileOrder[31] = new Basic("Pacific Avenue", 300, 26); _TileOrder[32] = new Basic("North Carolina Avenue", 300, 26); _TileOrder[33] = new CardSpace("Community Chest"); _TileOrder[34] = new Basic("Pennsylvania Avenue", 320, 28); _TileOrder[35] = new Railroad("Short Line Railroad", 200, 25); _TileOrder[36] = new CardSpace("Chance"); _TileOrder[37] = new Basic("Park Place", 350, 35); _TileOrder[38] = new FreeParking("Luxury Tax"); //LuxuryTax _TileOrder[39] = new Basic("Boardwalk", 400, 50); }