private void LabelButtonWithCost() { Text costText = GetComponentInChildren <Text>(); if (!costText) { Debug.LogError(name + " has no cost text, add some!"); } else { costText.text = defenderPref.GetManaCost().ToString(); } }
private void AttemptToSpawnDefender(Vector2 gridPos) { var manaDisplay = FindObjectOfType <ManaDisplay>(); int defenderCost = defender.GetManaCost(); if (manaDisplay.HaveEnoughMana(defenderCost)) { SpawnDefender(gridPos); manaDisplay.RemoveMana(defenderCost); } else { return; } }
private void AttemtToPlaceDefenderAt(Vector2 gridPos) { if (!defender) { return; } var manaDisplay = FindObjectOfType <ManaDisplay>(); int defenderCost = defender.GetManaCost(); if (manaDisplay.HaveEnoughMana(defenderCost)) { manaDisplay.SpendMana(defenderCost); SpawnDefender(gridPos); } }
private void AddCostText() { Text costText = GetComponentInChildren <Text>(); costText.text = defenderPrefab.GetManaCost().ToString(); }