Beispiel #1
0
        public void Load()
        {
            CurrencyDto dto = SaveManager.Get(SaveKeys.CurrencyDataKey, new CurrencyDto()) as CurrencyDto;

            if (dto == null)
            {
                return;
            }

            // set totalCoins to the save game value
            _totalCoins = dto.TotalCoins;
            OnCoinAmountChanged?.Invoke(_totalCoins, CurrencyType.Regular);
        }
Beispiel #2
0
 /// <summary>
 ///     Player spent coins.
 /// </summary>
 /// <param name="amount">Amount of coins spent</param>
 /// <param name="type">Type of currency spent</param>
 public void SpendCoins(int amount, CurrencyType type)
 {
     _totalCoins -= amount;
     OnCoinAmountChanged?.Invoke(_totalCoins, type);
 }