Ejemplo n.º 1
0
    private void PlaceDefenderAt(Vector2 gridPos)
    {
        var coinsDisplay = FindObjectOfType <CoinsDisplay>();
        int defenderCost = defenderType.GetCoinCost();

        if (coinsDisplay.HaveEnoughCoins(defenderCost))
        {
            SpawnDefender(gridPos);
            coinsDisplay.SpendCoins(defenderCost);
        }
    }
Ejemplo n.º 2
0
    private void LabelButtonWithCost()
    {
        Text costText = GetComponentInChildren <Text>();

        if (!costText)
        {
            Debug.LogError(name + "has no cost text");
        }
        else
        {
            costText.text = defenderPrefab.GetCoinCost().ToString();
        }
    }
 private void AttemptToPlaceDefenderAt(Vector2 gridPos)
 {
     if (defender != null && FindObjectOfType <CoinDisplay>() != null)
     {
         var CoinDisplay  = FindObjectOfType <CoinDisplay>();
         int defenderCost = defender.GetCoinCost();
         //if we have enough coin
         if (CoinDisplay.HaveEnoughCoin(defenderCost))
         {
             SpawnDefender(gridPos);
             CoinDisplay.SpendCoin(defenderCost);
         }
     }
 }
Ejemplo n.º 4
0
    private void AttemptToPlaceDefender()
    {
        var coinDisplay  = FindObjectOfType <CoinDisplay>();
        int defenderCost = defender.GetCoinCost();

        if (coinDisplay.HaveEnoughCoins(defenderCost))
        {
            SpawnDefender(GetSquareClicked());
            coinDisplay.SpendCoins(defenderCost);
        }
        else
        {
            return;
        }
    }