public void sell() { destroy(); int ret = 0; for (TowerType t = getTowerType(); t != null; t = t.getBase()) { ret += t.getCost(); } m.getGame().setMoney(m.getGame().getMoney() + ret); }
public Tower upgradeTo(TowerType t) { if (m.getGame().getMoney() >= t.getCost()) { m.getGame().setMoney(m.getGame().getMoney() - t.getCost()); Tower t2 = m.getGame().createTower(t); t2.setX(getX()); t2.setY(getY()); destroy(); return t2; } else { m.getGame().setStatus("Not enough money!"); m.setNewEvent( new Event(m, 2000, 1) { public void run(int delta) { m.getGame().setStatus("", "Not enough money!"); } }); } return null; }
public final void setGridsList() { this.gridsList = new ArrayList<Grid>(); addLinkedGrid(towerType.getRange(level), grid, gridsList); }