Ejemplo n.º 1
0
 private void AttempToPlaceDefender()
 {
     if (!outOfBounds)
     {
         DefenderSpawner dsp         = FindObjectOfType <DefenderSpawner>();
         var             CoinDisplay = FindObjectOfType <CoinDisplay>();
         if (sellButton)
         {
             Defender placedDefender = dsp.getDefender(currentSpawnPos);
             if (placedDefender)
             {
                 int defenderCost = placedDefender.GetCost();
                 CoinDisplay.Addcoins((int)(defenderCost * dsp.getSellFactor()));
                 Destroy(placedDefender.gameObject);
             }
         }
         else
         {
             int defenderCost = defenderPrefab.GetCost();
             if (CoinDisplay.Spendcoins(defenderCost))
             {
                 Spawn();
             }
         }
     }
 }