Example #1
0
 public bool Purchase(int count, Player customer, Inventory inventory)
 {
     lock(this)
     {
         int cost = price * count;
         if (stock >=count && customer.SpendMoney(cost))
         {
             stock -= count;
             return inventory.Stack(item.Instantiate(count) as Item);
         }
         else
         {
             return false;
         }
     }
 }