public VmData(VmDrinks drinks, VmAccount account, VmMoney money, UserWallet wallet, UserDrinks userDrinks) { this.drinks = drinks; this.account = account; balance = account.Balance(); this.money = money; this.wallet = wallet; this.userDrinks = userDrinks; }
public void AddBalance(int delta, VmMoney money) { for (int i = money.coins.Length - 1; i >= 0; i--) { for (int j = money.quantity[i]; j >= 0; j--) { if (delta - money.coins[i] >= 0) { delta -= money.coins[i]; money.quantity[i]--; quantity[i]++; } else { break; } } } }