Exemplo n.º 1
0
    private void AttemptToSpawnAt(Vector2 gridPos)
    {
        var eggsDisplay  = FindObjectOfType <EggsDisplay>();
        int defenderCost = defender.GetEggsCost();

        if (eggsDisplay.HaveEnoughEggs(defenderCost))
        {
            SpawnDefender(gridPos);
            eggsDisplay.SpendEggs(defenderCost);
        }
    }
Exemplo n.º 2
0
 private void LabelButtonWithCost()
 {
     Text costText = GetComponentInChildren<Text>();
     if (!costText)
     {
         //Debug.LogError(name + " has no cost text.");
     }
     else
     {
         costText.text = defenderPrefab.GetEggsCost().ToString();
     }
 }