Game Development Reference
In-Depth Information
300, 250));
//the menu background box
GUI.Box(new Rect(0, 0, 300, 250), "");
// Information text
GUI.Label(new Rect(15, 10, 300, 68), "Do you want
to travel?");
//Player wants to leave this location
if (GUI.Button(new Rect(55, 100, 180, 40),
"Travel"))
{
showDialog = false;
// The following line is commented out for now
// as we have nowhere to go :D
//Application.LoadLevel(1);}
//Player wants to stay at this location
if (GUI.Button(new Rect(55, 150, 180, 40), "Stay"))
{
showDialog = false;
}
//layout end
GUI.EndGroup();
}
}
The function itself is very simple and only activates if the showDialog flag is set to
true by the collision detection. Then, we will perform the following steps:
1. In the OnGUI method, we set up a dialog window region with some text and two
buttons.
2. One button asks if the player wants to travel, which would load the next area
(commented out for now as we only have one scene), and close the dialog.
Search WWH ::




Custom Search