I try make door open when Player have get keys. Else Gui text tell find this keys. Something in my script is wrong couse GUI text wont show up. I attact Script and every var what i put in code. Can someone tell where is problem?
#pragma strict
var auki : Animation;
var avain : GameObject;
private var drawGUI1 = false;
private var drawGUI2 = false;
function Start () {
}
function Update () {
if (drawGUI2 == true && Input.GetKeyDown(KeyCode.E))
{
animation.Play("auki");
}
}
function OnTriggerEnter (theCollider : Collider)
{
if (theCollider.tag == "Player" && avain == true)
{
drawGUI1 = true;
}
if (theCollider.tag == "Player" && avain == false)
{
drawGUI2 = true;
}
}
function OnGUI ()
{
if (drawGUI1 == true)
{
GUI.Box (Rect (Screen.width*0.5-51, 200, 102, 22), "Find Key");
}
if (drawGUI2 == true)
{
GUI.Box (Rect (Screen.width*0.5-51, 200, 102, 22), "Press E");
}
}
I try couple differend ways to do this, but GUI text still wont show up.