Example #1
0
    private void AttemptToPlaceDefender(Vector2 gridPos)
    {
        var coinCounter  = FindObjectOfType <CoinCounter>();
        int defenderCost = defender.GetCoinValue();

        if (coinCounter.HaveEnoughStars(defenderCost))
        {
            SpawnDefender(gridPos);
            coinCounter.SpendCoins(defenderCost);
        }
    }
Example #2
0
    private void LabelButtonWithCost()
    {
        Text costText = GetComponentInChildren <Text>();

        if (!costText)
        {
            // Debug.LogError(name + "No cost text");
        }
        else
        {
            costText.text = defenderPrefab.GetCoinValue().ToString();
        }
    }