Hello everyone.
I know that this code is wrong. could someone help me with it?
Its my 1st script (by heart) im writing and i got stuck. I just cant think of how i can
make 10 image change until 0 and then load the game. (I can see the number i added in
Texture due to the ExecuteInEditMode but not when i press start)
Does someone knows how i can change this?
@script ExecuteInEditMode;
// the textfield to update the time to
public var textfield: Texture;
// time variables
public var allowedTime:int = 10;
private var currentTime = allowedTime;
private var r_textfield : Rect = new Rect (10, 10, 40,80);
function Start () {
CountDown();
}
function Update () {
if (currentTime <= 0)
{
Application.LoadLevel(“Level”);
}
}
function Awake(){
// retrieve the Material Number Component and set the texture
textfield = GetComponent(Texture);
}
function CountDown(){
while( true ){
currentTime = currentTime - 1;
yield WaitForSeconds(1);
}
}
function OnGUI(){
GUI.DrawTexture (r_textfield, textfield);
}