Exemple #1
0
 public void Down()
 {
     if (MoneyHandler.Money >= tower.GetTowerCost())
     {
         MoneyHandler.RemoveMoney(this.tower.GetTowerCost());
         GameObject tower = Instantiate(this.tower.GetTowerPrefab(), towerPlace.position, Quaternion.identity);
         tower.transform.parent = towerPlace;
         towerPlace.gameObject.GetComponent <TowerPlace>().TowerIsBuild();
         BuildUI.ChangeBuildBool();
         BuildUI.DestroyUI();
     }
 }
Exemple #2
0
 private void OnMouseDown()
 {
     if (!BuildUI.IsReadyToBuild() && !isClicked && isFree)
     {
         BuildUI.CreateTowerBuildUI(this.transform);
         isClicked = true;
         BuildUI.ChangeBuildBool();
     }
     else if (BuildUI.IsReadyToBuild() && isClicked && isFree)
     {
         BuildUI.DestroyUI();
         isClicked = false;
         BuildUI.ChangeBuildBool();
     }
 }