Game Development Reference
In-Depth Information
Step 28: Create a new trigger and place it just behind the EntryWay doors
( Figure 13.7 ). This can be a bit hard to make out in the screenshot, but
think of this trigger as being just inside the doors so that as the doors
open and the player walks in, he'll hit this trigger. Name the trigger
Trigger-HallwayPortal .
Figure 13.7 Placed Hallway
portal trigger.
Step 29: Ensure this trigger still has the EntryWayTextTriggerScript
attached to it.
Step 30: Open EntryWayTextTriggerScript.
Step 31: Include the following statement:
private var guiTextObject : GameObject;
function Awake(){
guiTextObject = GameObject.Find(“GUITextHints”);
}
function OnTriggerEnter (other:Collider){
if (name == “Trigger-FindDoorHint”){
guiTextObject.GetComponent(EntryWayGUITextScript)
.FindDoorHint();
}
if (name == “Trigger-WaterHint”){
guiTextObject.GetComponent(EntryWayGUITextScript)
.StayOutOfWaterHint();
}
if (name == “Trigger-EMPHint”){
guiTextObject.GetComponent(EntryWayGUITextScript)
.TryEMPHint();
}
if (name == “Trigger-HallwayPortal”){
Application.LoadLevel (“Scene-Hallway”);
}
}
Search WWH ::




Custom Search