Door Script:
Door will have string that has an ID on the door and the Key interacts with it using the same ID on the Key. (See Key)
Open/Close State
The player can interact with a door (Press E) to toggle between open and closed.
The door swings outward from the player’s position.
A highlight effect appears when looking at an interactable door.
Locked State
If a door is locked, the player must have the correct key to unlock it.
Once unlocked, the door remains interactable for opening/closing.
Key Requirement & Unlocking
Each door has a key id name string (e.g., "108") that determines which key unlocks it.
If the player has the matching key, the door unlocks and plays an unlocking sound effect.
The key is removed from the player inventory after use.
Sounds:
Open/Close State
Plays a lock door trying to be open
First Door & First Locked Door:
First Door
When the player hovers over the first door of the game it displays text with the button to open it ("Press E to open door")
First Locked Door
When the player hovers over the first locked door of the game it will display text.
Hovers over the door without a key displays ("You must find a key to open the door")
Hovers over the door with the key will say ("Press E to unlock the door")
Hovers over the door that is not locked any more will display the First Door text above.
Text is anchor to the center and position is -30 Y, the font size is 30 in the GameplayUI.