How to Unlock the Door with a Looted Item.
Before start learning about this system, which is built on top of previous features, to understand, start from the beginning of my article about the game logic Interaction project, especially if you are a beginner.
Here is a Link for the whole series from the beginning



Now, go back to the Door script and create a bool variable and an itemType variable.
Create a method with a bool return type that takes AllItems as a parameter. Check if we have itemRequired in the list of inventory items; if true, we need to return true; else, we will return false.
Go to the Interact method inside the else statement, check if _requiresItem is true, then check if HasRequiredItem returns by passing _requiredItem as a parameter. Then, unlock the Door by calling the Activate method and setting the parameter to true, but if the condition is false, then we will tell the player to check the Terminal.
Note: The last Debug is when the door dont _requiresItem when _requireItems is false and the door is locked, the last debug will be called.
In this step, I will unlock the door after collecting the key, but first, go to the Inspector and check _requiresItem if you want this door to be open by lootItem.
See into the next one.
