Game Development Reference
In-Depth Information
Step 35: Further flesh out the checking mechanism to include the
Mission button:
var dataPanelBiography : GameObject;
var dataPanelMission : GameObject;
function OnMouseEnter () {
guiTexture.color = Color (1,1,1);
}
function OnMouseExit (){
guiTexture.color = Color (.2,.2,.2);
}
function OnMouseDown(){
if (name == “Button_Bio”){
dataPanelBiography.guiTexture.enabled = true;
dataPanelMission.guiTexture.enabled = false;
}
if (name == “Button_Mission”){
dataPanelMission.guiTexture.enabled = true;
dataPanelBiography.guiTexture.enabled = false;
}
}
Why?
Now, when the object is clicked it checks to see if the name of the object
is “Button_Bio”; if it is not, it checks to see if its name is “Button_Mission”
and if it is, it disables dataPanelMission's GUITexture and enables
dataPanelBiography's GUITexture.
Step 36: Allow the game to start on clicking the begin button.
var dataPanelBiography : GameObject;
var dataPanelMission : GameObject;
function OnMouseEnter () {
guiTexture.color = Color (1,1,1);
}
function OnMouseExit (){
guiTexture.color = Color (.2,.2,.2);
}
function OnMouseDown(){
if (name == “Button_Bio”){
dataPanelBiography.guiTexture.enabled = true;
dataPanelMission.guiTexture.enabled = false;
}
if (name == “Button_Mission”){
dataPanelMission.guiTexture.enabled = true;
dataPanelBiography.guiTexture.enabled = false;
 
Search WWH ::




Custom Search