Using the "Contain" method on a list with various variables.
I'm in a bit of a pickle here.
The logic, seems simple, but I have no idea on how to go about it.
I'm creating an inventory system, basic one.
You find an object in the world, you approach it, you press Use, and it adds a inventoryItem class and adds it to the playerInventory via a List.
The list contains inventoryItem class, which containts 4 elements, ID, Name, Image and Type.
That I have done,
but now, assume that I have a locked door and it require a specific key, this key should be in the inventory, let's pretend the key is Red.
How do I use the "Contain" method to check if the player has a Red Key (say via the ID which would be keyRed)?
Also, how do I remove an instance of this keyRed from the list when the door is "opened" (and uses the key)?
Your answer
Follow this Question
Related Questions
How to know if a list contains GameObjects with a specific Varaible values ? 0 Answers
How do I modify variables from a different class that belongs to the same C# file? 1 Answer
Adding to List of Nested Classes 1 Answer
How do I implement lists for this? Or should I? 0 Answers
Collection was modified; enumeration operation may not compute 0 Answers