public bool Sell(int count, Player seller ,Inventory inventory) { lock(this) { if (inventory.Sum(x=>(x.id == item.id)?x.itemCount:0) >= count && stock + count <= maxStock) { inventory.Consume(item.Instantiate(count) as Item); stock += count; seller.GetMoney(price * count); return true; } else { return false; } } }