Game Development Reference
In-Depth Information
After attaching CollectableKey script to the key object, we need to specify the secret text that
uniquely identifi the key/lock pair and type the value in key fi ld. For this example I use “door1”.
When the player character collides with this key, the value door1 will be added to keys list
inside InventoryBox . To complete the demo, we need to add a lock to our door. Remember that
we have used Hinge Joint component to create the door, which makes door movement under
the control of physics simulator. Therefore, to lock the door we need to freeze its position and
rotation. Th s task is performed by PhysicsDoorLock script shown in Listing 64.
Search WWH ::




Custom Search