private void AttemptToPlaceDefenderAt(Vector2 gridPos) { var DcoinDisplay = FindObjectOfType <DcoinDisplay>(); int defenderCost = defender.GetDcoinCost(); if (DcoinDisplay.HaveEnoughDcoins(defenderCost)) { SpawnDefender(gridPos); DcoinDisplay.SpendDcoins(defenderCost); } }
private void LabelButtonWithCost() { Text costText = GetComponentInChildren <Text>(); if (!costText) { Debug.LogError(name + " has no cost text, add a cost text!"); } else { costText.text = DefenderPrefab.GetDcoinCost().ToString(); } }