Game Development Reference
In-Depth Information
Step 9: Create and place a cube to match Figure 13.5 . Create the cube
with GameObject>Create Other>Cube. Move, scale, and rotate the cube
so its location approximates Figure 13.5 .
Figure 13.5 Placed cube to act as
first trigger.
Why?
Basically we're boxing in the First Person Controller. No matter where the
player goes, he will hit this box and get the first bit of information that will
tell him to go find the door.
Step 10: Rename the cube Trigger-FindDoorHint .
Step 11: Make Trigger-FindDoorHint a trigger. Do this in the Inspector
with the object selected. Look for the Box Collider component and click
the Is Trigger option.
Why?
Visually nothing will change, but functionally things are different in Unity.
Go ahead and try playing the game right now and you will walk right
through that box. The collider is no longer stopping you, just noting that
you have collided (or entered) its volume.
Scripting the GUIText
The scripting for this section will be in two parts. One script, which will be
attached to the GUITextHints object (the GUIText) will control what text
is shown and for how long. The second script that will be attached to the
triggers will be responsible for determining when a trigger is tripped, and
then sending the message to the GUIText object to display the appropriate
text. We'll build the GUIText controlling script first.
Step 12: In your Project panel, select the Scripts folder (where you'll want to
store scripts). Create a new JavaScript and name it EntryWayGUITextScript .
Double-click the script to open it in your script editor.
Search WWH ::




Custom Search