IEnumerator CheckForCollision() { yield return(null); if (collided) { ScoreKeep sk = FindObjectOfType <ScoreKeep>(); sk.SpendMoney(-300); Debug.Log("Can not place here"); Destroy(this.gameObject); } }
public void PlaceTurret() { if (money >= 300) { GameObject tempTurret = Instantiate(Turrets[selectedTurret]); tempTurret.transform.position = Input.mousePosition; tempTurret.transform.parent = this.transform; ScoreKeeper.SpendMoney(300); Debug.Log("Tower placed"); selectedTurret = -1; } else { Debug.Log("Need more money"); } }