Hi Everyone
Can anyone help me with this problem please. I’ve got this scenario where a game object move forwards and after 26 seconds it respawns back to its original position. Now directly opposite this first game object is a second game object that does the same thing as the first game object. The only problem I have is I want them to take turns moving forward and respawning. So the first one moves forward then respawns & stops moving. The second one then moves forward, respawns & stops moving allowing the first one to move forward. You get the picture the only other thing that I would like to add would be that is would have to be continuous cycle. Here’s my code so far:
var Sec2Respawn : float = 26.0;
function Update(){
transform.Translate(0, 0, -1 * Time.deltaTime);
if(Sec2Respawn > 0){
Sec2Respawn -= Time.deltaTime;
}
if(Sec2Respawn <= 0){
Sec2Respawn = 26.0;
var parentMill = GameObject.Find("MovementWindMill");
parentMill.transform.position = Vector3(2.508217, 6.518723, 25.69707);
}
}
Help much appreciated. Thanks