public void BuyTurret() { MenuController.turretDetailMenu.currentTower = turretForSale; CurrencyController.AdjustCurrency(-turretForSale.cost); SetTowerInGrid(); MenuController.SetActiveMenu(MenuController.turretDetailMenu); }
public void SellTurret() { CurrencyController.AdjustCurrency(currentTower.sellValue); Tile tile = Tile.activeTile; Destroy(tile.turret.gameObject); tile.SetWalkable(); MenuController.SetActiveMenu(MenuController.constructTowerMenu); }
public void EndLevel() { levelActive = false; CurrencyController.AdjustCurrency(levels[currentLevel].rewardForCompletingLevel); levels[currentLevel].gameObject.SetActive(false); currentLevel++; if (currentLevel >= levels.Length && LivesController.livesLeft > 0) { MenuController.winLoseUI.EnableWinUI(); } }
void OnTriggerEnter(Collider collider) { if (collider.GetComponent <Bullet>()) { float damageDealt = collider.GetComponent <Bullet>().damage; health -= damageDealt; Destroy(collider.gameObject); if (health == 0) { CreateExplosionEffect(); CurrencyController.AdjustCurrency(rewardOnDestroy); spawner.IncrementEnemiesDestroyed(); Destroy(this.gameObject); } } }
public void UpgradeTurret() { int upgradeCost = currentTower.upgradesTo.cost; Destroy(Tile.activeTile.turret.gameObject); currentTower = Instantiate(currentTower.upgradesTo); Tile.activeTile.SetTurret(currentTower); if (currentTower.upgradesTo == null) { SetUpgradeButtonActive(false); } sellValueText.text = "$" + currentTower.sellValue.ToString(); CurrencyController.AdjustCurrency(-upgradeCost); }