public void BuyTurret()
 {
     MenuController.turretDetailMenu.currentTower = turretForSale;
     CurrencyController.AdjustCurrency(-turretForSale.cost);
     SetTowerInGrid();
     MenuController.SetActiveMenu(MenuController.turretDetailMenu);
 }
示例#2
0
    public void SellTurret()
    {
        CurrencyController.AdjustCurrency(currentTower.sellValue);
        Tile tile = Tile.activeTile;

        Destroy(tile.turret.gameObject);
        tile.SetWalkable();
        MenuController.SetActiveMenu(MenuController.constructTowerMenu);
    }
示例#3
0
    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();
        }
    }
示例#4
0
 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);
         }
     }
 }
示例#5
0
    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);
    }