private void AttemptToPlaceDefenderAt(Vector2 gridPosition) { var donutDisplay = FindObjectOfType <DonutDisplay>(); int defenderCost = defender.GetDonutCost(); if (donutDisplay.HaveEnoughDonuts(defenderCost) && PreventSpawnOverlap(gridPosition)) { StartCoroutine(WaitAndSpawn(gridPosition)); donutDisplay.SpendDonuts(defenderCost); } }
private void LabelButtonWithCost() { TextMeshProUGUI costText = GetComponentInChildren <TextMeshProUGUI>(); if (!costText) { Debug.LogError(name + " has no cost text."); } else { costText.text = defenderPrefab.GetDonutCost().ToString(); } }