常用方法
常用方法
常用方法
常用方法
void Buy(IItem item) { if (Gold < item.Price) { throw new Exception("Not enough gold to buy this item"); } Gold -= item.Price; item.AddToInventory(this); }
void Buy(IItem item) { if (Gold < item.Price) { throw new Exception("Not enough gold to buy this item"); } Gold -= item.Price; item.AddToInventory(this); }