generate a function for losing player items at death
Func<Item> LoseItem = () => { if (playerInventory.Count == 0) { return null; } var index = random.Next(0, playerInventory.Count); var item = playerInventory[index]; playerInventory.RemoveAt(index); return item; }