public bool CanPurchaseItem(StoreItem item, BankPlayer bank) { bool result = false; if (item != null) { if (bank.CanSendTransfer(item.PriceCoinsA, TypeCoins.A) && bank.CanSendTransfer(item.PriceCoinsB, TypeCoins.B)) { result = true; } } return(result); }
public bool BuyItem(String id, BankPlayer bank) { bool result = false; StoreItem item = GetItem(id); if (CanPurchaseItem(item, bank) == true) { if (bank.SendTransfer(item.PriceCoinsA, TypeCoins.A)) { creditsA += item.PriceCoinsA; } if (bank.SendTransfer(item.PriceCoinsB, TypeCoins.B)) { creditsB += item.PriceCoinsB; } result = true; } return(result); }