Hi , I use this script below to open a door using only code, the script works very well.
I would like the door opened slowly, and also pressing the “A” key on your keyboard.
Could anyone help me with details if possible , because I do not know JavaScript very well . thank you
var close = false;
var doorCode : String = "";
var stringToEdit : String;
var buttonMessage : String = "type code";
function SetTheGUI () {
close = true;
}
function UnSetGUI () {
close = false;
}
function OnGUI(){
if (close){
stringToEdit = GUI.TextField (Rect (500, 300, 120, 25), stringToEdit, 10);
if(stringToEdit == doorCode){
buttonMessage = "open Door";
}else{
buttonMessage = "type code";
}
if(GUI.Button(Rect(500, 265 , 120, 25), buttonMessage) && stringToEdit == doorCode){
transform.Rotate(-90,0,0);
}
}
}