Ejemplo n.º 1
0
 //Whenever a TowerButton is clicked in the shop we check if the player has enough currency to buy the tower, and we call showHover() if we do.
 //If we don't have enough money we simply cannot select the Tower.
 public void TowerSelected(TowerButton towerBtn)
 {
     if (currency >= towerBtn.Price)
     {
         this.towerSelected = towerBtn;
         TowerHover tH = GameObject.FindObjectOfType <TowerHover>();
         tH.showHover(towerBtn.Sprite);
     }
 }
Ejemplo n.º 2
0
 //BuyTower() is called whenever we try and SetTower() and it checks if we have enough money to buy the Tower. If we have enough,
 //BuyTower() subtracts our currency by the price of the Tower, hides the hover object, and sets our towerSelected to null.
 public void BuyTower()
 {
     if (currency >= towerSelected.Price)
     {
         Currency -= towerSelected.Price;
         TowerHover tH = GameObject.FindObjectOfType <TowerHover>();
         tH.hideHover();
         towerSelected = null;
     }
 }