Game Development Reference
In-Depth Information
Why?
Just like in the last chapter, what this will do is that when the trigger is
penetrated by another collider (like our First Person Controller), if the
trigger's name is Trigger-HallwayPortal (which this trigger is), then the
current level (Scene-EntryWay) will close as Scene-Hallway is loaded.
Step 32: Save and return to Unity. Fix any syntax errors that pop up in the
console.
Step 33: If Scene-Hallway has not been added to the Scenes in Build
section of the Build Settings, do so now (File>Build Settings).
Step 34: To test this trigger, we will need to temporarily deactivate the
doors. If you are using the version included on the web site ( http://www
.Creating3dGames.com ) these are called EntryWayDoorGroup. If you're
using your own, select the GameObject in the Hierarchy and turn it off in
the Inspector (be sure to include the children when deactivating).
Why?
When the game is actually finished, these doors will (of course) be active.
The goal of this part of the game will be to use the EMP to short out the
card reader that will open the doors. When the doors are open, the player
can then walk into them where he would hit the trigger. The key is that
we don't want the player to be able to hit this trigger before the doors are
open so the trigger needs to be back behind the doors.
Step 35: Test; walk through this trigger and see if you end up in the hallway.
Step 36: If all's well, reactivate the doors.
Step 37: Apply all the changes you've made to the First Person Controller
prefab, so that it can be used elsewhere. Select First Person Controller in
the Hierarchy, and in the Inspector press the Apply Button on the Prefab
line. We want all the interface details to be included here in other levels.
We'll discuss much more about prefabs later (Chapter 15).
Step 38: Create a new prefab and name it GUIElements (remember to
do this in the Project panel). Drag GUITextHints from the Hierarchy panel
to this new GUIElements prefab in the Project panel (this populates the
new prefab). Now, delete GUITextHints from the Project panel and drag
GUIElements up to the Hierarchy. Finally, make sure that GUIElements'
Transform Position XYZ are all set to 0 (this is done by selecting GUIElements
in the Hierarchy and changing the values (if needed) in the Inspector).
Why?
We've carefully arranged these GUITextHints to be at the bottom of the screen,
and we've done this with the Transform Position settings. If the parent of the
GUITextHints is not at 0,0,0 then Unity has to do some funny tweaking to the
values of its children to get them in the same place as they were before being
children. So taking just a second and making sure that empty parent objects
are indeed at a position of 0,0,0 will help solve all sorts of problems later.
Search WWH ::




Custom Search