Beispiel #1
0
    public void SellFocusTower()
    {
        if (focusTower != null)
        {
            float sellCoins      = 0;
            Tower focusTowerComp = focusTower.GetComponent <Tower>();
            if (focusTowerComp.getRoundWhenCreated() != currentRound)
            {
                sellCoins = focusTowerComp.towerPrice / 2;
            }
            else
            {
                sellCoins = focusTowerComp.towerPrice;
            }
            sellCoins         *= (focusTowerComp.getCurrentHealth() / focusTowerComp.towerTotalHealth);
            GeneralPool.coins += sellCoins;
            uiHelper.updateCoinCountText(GeneralPool.coins);


            GeneralPool.getBP(focusTower).SetActive(true);
            GeneralPool.removeFromTowerAndBPDict(focusTower);
            GeneralPool.removeFromTowerList(focusTower);
            Destroy(focusTower);
            focusTower = null;
            towerOperatePanel_Prepare.transform.localScale = Vector3.zero;
        }
    }
Beispiel #2
0
 public void Die()
 {
     if (towerName == "Gate")
     {
         GameObject.Find("GameController").GetComponent <RoundController>().removeFromGateList(gameObject);
     }
     else
     {
         GameObject BP = GeneralPool.getBP(gameObject);
         if (BP == null)
         {
         }
         else
         {
             BP.SetActive(true);
         }
     }
     GeneralPool.removeFromTowerAndBPDict(gameObject);
     GeneralPool.removeFromTowerList(gameObject);
     Destroy(gameObject);
 }