5/12/2010

GUI script

var message : TextAsset;
var Soundscape : GameObject;
var guicharacters = true;
var characterTalking = "Sophia";
var characterAvatar : Texture2D;
var characterSpeech : TextAsset;

function Awake () {

//check if soundscape = on
if (MainScreen_GUI.musicToggle == true) {
print ("Woohoo!");
Soundscape.audio.Play();
}
}


function OnGUI () {

//Message box
GUI.Box (Rect (Screen.width * 0.02, Screen.height * 0.8, Screen.width * 0.96, 120), "Messages");
GUI.Label (Rect (Screen.width * 0.05, Screen.height * 0.83, Screen.width * 0.90, 110), message.text);

//character box

//if statement here
if (guicharacters == true) {
//avatar box
GUI.Box (Rect (Screen.width * 0.02, Screen.height * 0.02, Screen.width * 0.13, Screen.height * 0.21), characterTalking);
GUI.Label (Rect (Screen.width * 0.03, Screen.height * 0.04, Screen.width * 0.145, Screen.height * 0.185), characterAvatar);
//speech box
GUI.Box (Rect (Screen.width * 0.16, Screen.height * 0.02, Screen.width * 0.82, Screen.height * 0.17), "Speech");
GUI.Label (Rect (Screen.width * 0.17, Screen.height * 0.05, Screen.width * 0.80, Screen.height * 0.17), characterSpeech.text);
}

//gui toggle
guicharacters = GUI.Toggle (Rect (240, 325, 100, 20), guicharacters, " GUI On/Off");

}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.