private void AttemptToPlaceDefenderAt(Vector2 gridPos) { var mineralDisplay = FindObjectOfType <MineralDisplay>(); int defenderCost = defender.GetMineralCost(); if (mineralDisplay.HaveEnoughMinerals(defenderCost)) { SpawnDefender(gridPos); mineralDisplay.SpendMinerals(defenderCost); } }
private void LabelButtonWithCost() { Text costText = GetComponentInChildren <Text>(); if (!costText) { Debug.LogError(name + " has no cost text"); } else { costText.text = defenderPrefab.GetMineralCost().ToString(); } }