Well Basically i want a Gui Texture to change to another gui texture 1 min later, and then to another Gui Texture another 1 min later, (max 2 times) and when u walk through a trigger the script resets happening all over again.
SO e.g. green icon goes to yellow, yellow icon goes to red (1 min intervals) player walks through a Trigger, it all resets going back to the first Gui texture happening all over again.
hope i worded this correctly. any ideas? i wouldnt know how to start a script like this.
You can set a timer to loop through the textures in Update, and reset this loop in OnTriggerEnter - like this (trigger script):
var gTexture: GUITexture; // drag the GUITexture here
var textures: Texture2D[]; // define the textures here
var interval: float = 60.0; // interval in seconds
private var timer: float = 0.0;
private var curTex: int = 0;
function Update(){
timer -= Time.deltaTime; // decrement timer
if (timer < 0.0) SetTexture(); // set the texture
}
function SetTexture(){
gTexture.texture = textures[curTex++]; // assign current texture and advance pointer
curTex = curTex % textures.length; // return to first one if passed the last
timer = interval; // reset timer
}
function OnTriggerEnter(){
curTex = 0; // reset texture pointer...
SetTexture(); // assign current texture and reset timer
}