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(); } }
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(); } }