Starting By using a simple GUI Box function
function OnGUI() {
GUI.Box(Rect(0,0,100,100),"This is a title");
}
=======================================================================
another script for a simple dialogue
========================================================================
var honey_num = 0;
var MessageBoxText : String;
var showText : boolean = false;
function OnControllerColliderHit(hit:ControllerColliderHit)
{
if(hit.gameObject.tag == "cube")
{
//Get the Honey Counter Object
//var honey_counter = GameObject.Find("HoneyCount");
Debug.Log("Zam Gets a HoneyComb");
// Destroy(hit.gameObject);
honey_num++;
showText = true;
//honey_counter.gameObject.GUIText.Text = honey_num;
}
}//END FUNCTION ONCONTROLLERCOLLIDERHIT
function Update () {
}
function OnGUI() {
if (showText)
{
//target.SendMessage("SetControllable", false);
GUI.BeginGroup (new Rect (Screen.width / 2 - 640, Screen.height / 2 - 360, 1280, 720));
//GUI.skin = MessageBoxSkin;
GUI.Box(new Rect (100, 500, 1080, 200),
MessageBoxText + "\n\n Press F to continue...");
GUI.EndGroup ();
if(Input.GetKeyDown(KeyCode.F)){
Deactivate();
}
}
else
{
//target.SendMessage("SetControllable", true);
}
//GUI.Box(Rect(0,0,100,100),"Hello AMR");
//GUI.Label (Rect (10, 10, 100, 20), "Hello World!");
}
function Active(){
return showText;
}
function Deactivate(){
yield WaitForSeconds(0.1);
showText = false;
}
function OnGUI() {
GUI.Box(Rect(0,0,100,100),"This is a title");
}
=======================================================================
another script for a simple dialogue
========================================================================
var honey_num = 0;
var MessageBoxText : String;
var showText : boolean = false;
function OnControllerColliderHit(hit:ControllerColliderHit)
{
if(hit.gameObject.tag == "cube")
{
//Get the Honey Counter Object
//var honey_counter = GameObject.Find("HoneyCount");
Debug.Log("Zam Gets a HoneyComb");
// Destroy(hit.gameObject);
honey_num++;
showText = true;
//honey_counter.gameObject.GUIText.Text = honey_num;
}
}//END FUNCTION ONCONTROLLERCOLLIDERHIT
function Update () {
}
function OnGUI() {
if (showText)
{
//target.SendMessage("SetControllable", false);
GUI.BeginGroup (new Rect (Screen.width / 2 - 640, Screen.height / 2 - 360, 1280, 720));
//GUI.skin = MessageBoxSkin;
GUI.Box(new Rect (100, 500, 1080, 200),
MessageBoxText + "\n\n Press F to continue...");
GUI.EndGroup ();
if(Input.GetKeyDown(KeyCode.F)){
Deactivate();
}
}
else
{
//target.SendMessage("SetControllable", true);
}
//GUI.Box(Rect(0,0,100,100),"Hello AMR");
//GUI.Label (Rect (10, 10, 100, 20), "Hello World!");
}
function Active(){
return showText;
}
function Deactivate(){
yield WaitForSeconds(0.1);
showText = false;
}
No comments:
Post a Comment