示例#1
0
    protected void ConstantGain()
    {
        int previousCurrency = currency.currentAmount;

        currency.AddCurrency(constantCurrencyAddition);
        int currentCurrency = currency.currentAmount;
        var info            = new CurrencyChangeInfo(previousCurrency, currentCurrency);

        currencyChanged?.Invoke(info);
    }
示例#2
0
 /// <summary>
 /// Fires when currency changed in <see cref="currencyGainer"/>
 /// </summary>
 /// <param name="info">
 /// The info for the currency gainer
 /// </param>
 protected void OnCurrencyChanged(CurrencyChangeInfo info)
 {
     if (audioSource != null)
     {
         audioSource.Play();
     }
     if (currencyParticleSystem != null)
     {
         currencyParticleSystem.Play();
     }
 }
示例#3
0
        private void UpdateButton(CurrencyChangeInfo info)
        {
            if (_currency == null)
            {
                return;
            }

            if (_currency.CanAfford(_tower.Cost) && !BuyButton.interactable)
            {
                BuyButton.interactable = true;
                towerIcon.color        = defaultColor;
                towerPrice.color       = defaultColor;
            }
            else if (!_currency.CanAfford(_tower.Cost) && BuyButton.interactable)
            {
                BuyButton.interactable = false;
                towerIcon.color        = unAffordableInvalidColor;
                towerPrice.color       = unAffordableInvalidColor;
            }
        }