//Builds at given coordinates using the current tool. public void build(int x, int y) { //Checks if the spaces are available to build and if the player has enough money to play. Tool 9 is the bulldozer and has different rules. if (checkIfBuildable(x, y, Tools.currentTool.getHeight()) && GameRun.cash >= Tools.currentTool.getCost() && Tools.currentTool.getName() != "Empty") { //The rules for building Lobbies if (y == 41 && !Tools.currentTool.getName().Equals("Lobby")) { return; } if (!lobbyFloors.Contains(y) && Tools.currentTool.getName().Equals("Lobby")) { return; } if ((y != 41 && lobbyFloors.Contains(y)) && Tools.currentTool.getName().Equals("Lobby") && !towerMap[x, y - 1].getBuildingTypeString().Equals("Lobby")) { return; } occupy(x, y); towerMap[x, y].setSprite(buildingDataList.Find(b => b.getTypeName().Equals(Tools.currentTool.getName())).getEmptySprite(), Tools.currentTool); GameRun.chargeMoney(Tools.currentTool.getCost()); if (Tools.currentTool.getName().Equals("Lobby")) { DesiribilityModifier lobbyMod = new DesiribilityModifier("Lobby", -1000f); towerMap[x, y].addDesiribilityModifier(lobbyMod); } DesiribilityModifier baseModifier = new DesiribilityModifier("Base", 15f); towerMap[x, y].addDesiribilityModifier(baseModifier); if (Tools.currentTool.getName().Equals("Lobby")) { updateLobbySprites(x, y); } buildingsList.Add(towerMap[x, y]); } //Bulldoze if (Tools.currentTool.getName().Equals("Empty")) { //Only bulldozes non-empty buildings. if (towerMap[x, y].getBuildingType() != 9) { bulldoze(x, y); } } }
public void addDesiribilityModifier(DesiribilityModifier modifier) { desireModifiers.Add(modifier); }