protected void ConstantGain() { int previousCurrency = currency.currentAmount; currency.AddCurrency(constantCurrencyAddition); int currentCurrency = currency.currentAmount; var info = new CurrencyChangeInfo(previousCurrency, currentCurrency); currencyChanged?.Invoke(info); }
/// <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(); } }
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; } }