Game Development Reference
In-Depth Information
Step 23:
Apply this script to the Trigger-LockedDoor trigger.
Step 24:
Populate the script in the Inspector. Use Hallway_Door_
Bulkhead_Group 1 as the Door. Use Hallway_Door_BulkheadWheel 1
as the Bulkhead Handle. Use the Sound-DoorLocked as the Door Open
Sound.
Step 25:
Test and play. First go walk up to the trigger without picking up
the key (
Figure 16.9
) and the text should provide some guidance. Then
go back for the key (which should highlight;
Figure 16.10
), and then
disappear when it is clicked (which should also pull up the key icon in the
top-right corner). Finally, go back to the locked door, which should yield
before your mighty gaming prowess (
Figure 16.11
).
Step 26:
Make Trigger-LockedDoor a child of Hallway_BakedGroup.
Why?
We don't want the character getting tied up looking for the key before
he's turned the lights on. For one thing, the keybox doesn't exist yet.
By making the Trigger-LockedDoor a child of Hallway_BakedGroup, we
Figure 16.9
Walking up to the locked door, providing help on how to get through the door.
Figure 16.10
Raycasting against the key, which disappears when clicked.