public void SpendCoins(int amount) { if (amount > totalCoinsCollected) { throw new Exception("Trying to spend more coins than available, this is never allowed to happen!"); } totalCoinsCollected -= amount; PlayerPrefs.SetInt(TOTAL_COINS_COLLECTED_KEY, totalCoinsCollected); TotalCoinsUpdatedEvent?.Invoke(totalCoinsCollected); }
private void OnHitCoinPickup() { totalCoinsCollected += worldSequenceController.CurrentMultiplier; TotalCoinsUpdatedEvent?.Invoke(totalCoinsCollected); }