/// <summary> /// /// </summary> public void RangeButtonClick() { if (my_gameController.GetCurrency() > 0) { my_tower.towerRange += 10; my_currencyController.ChangeCurrency(-(my_tower.my_levelData.generalCost)); my_tower.specializeCount++; Hide(); } }
/// <summary> /// /// </summary> public void SellButtonClick() { my_tower.gameObject.GetComponentInParent <TowerPlaces>().ActivateMe(); my_currencyController.ChangeCurrency(my_tower.my_levelData.sellPrice); Hide(); Destroy(my_tower.gameObject); my_tower.specializeCount = 0; }
/// <summary> /// Build fuction for tower. /// Attached TowerBuildUI's buttons. /// </summary> public void BuildTower() { if (my_gameController.GetCurrency() > 0) { buttonName = EventSystem.current.currentSelectedGameObject.name; Debug.Log("create: " + buttonName); switch (buttonName) { case "Tower1": my_GameUI.BuyTower(Tower1, my_inputController.buildPosition, new Quaternion(0, 0, 0, 0)); my_currencyController.ChangeCurrency(-Tower1.GetComponent <Tower>().buildCost); activeTowerPlace.isOccupied = true; break; case "Tower2": my_GameUI.BuyTower(Tower2, my_inputController.buildPosition, new Quaternion(0, 0, 0, 0)); my_currencyController.ChangeCurrency(-Tower2.GetComponent <Tower>().buildCost); activeTowerPlace.isOccupied = true; break; case "Tower3": my_GameUI.BuyTower(Tower3, my_inputController.buildPosition, new Quaternion(0, 0, 0, 0)); my_currencyController.ChangeCurrency(-Tower3.GetComponent <Tower>().buildCost); activeTowerPlace.isOccupied = true; break; case "Tower4": my_GameUI.BuyTower(Tower4, my_inputController.buildPosition, new Quaternion(0, 0, 0, 0)); my_currencyController.ChangeCurrency(-Tower4.GetComponent <Tower>().buildCost); activeTowerPlace.isOccupied = true; break; default: break; } this.gameObject.SetActive(false); } }
public void GetHit(float dmg) { currentHealth -= dmg; healthBar.fillAmount = currentHealth / my_enemyData.startHealth; if (currentHealth <= 0) { my_currencyController.ChangeCurrency(my_enemyData.rewardCurrency); Destroy(gameObject); Instantiate(my_enemyData.shipSplitPrefab, this.transform.position, this.transform.rotation); } }