Generation

generate functionSat, 28 Jan 2023

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; }

Questions about programming?Chat with your personal AI assistant