public CurrencyData GetPurchase(int amount) { CurrencyData purchase = Value.Copy <CurrencyData>(); int difference = amount - purchase.Amount; purchase.ChangeBy(difference); return(purchase); }
public void SetCurrency() { if (ValueCurrencyType == CurrencyType.DogFood) { currency = FoodDatabase.GetInstance.Get(valueCurrencySubtype).Copy(); int difference = k.SINGLE_VALUE - currency.Amount; currency.ChangeBy(difference); } else { throw new System.NotImplementedException(); } }
public void ChangeCurrencyAmount(CurrencyData currency) { if (isDogFood(currency)) { ChangeFood(currency.Amount, (currency as DogFoodData).FoodType); } else { CurrencyData existingCurrency = getCurrency(currency.Type); existingCurrency.ChangeBy(currency.Amount); } tryCallCurrencyChangeEvent(currency.Type); }