// default unity function void OnMouseUp() { // check if there is a turret if (gameManagerControler.selectedTurret != null) { // add the turret to the screen and delete the placement Instantiate(gameManagerControler.selectedTurret, transform.position, Quaternion.identity); gameManagerControler.setSelectedTurret(null); Destroy(gameObject); } }
public void PurchaseStandardTurret() { if (gameManagerControler.GetMoney() >= price && gameManagerControler.getSelectedTurret() == null) { Debug.Log("standard turret purchased"); gameManagerControler.setSelectedTurret(turret); gameManagerControler.removeMoney(price); } else { Debug.Log("you can't buy this turret"); } }