new Vector3(7.5f,0f,7.5f), new Vector3(7.5f,0f,-7.5f), new Vector3(-7.5f,0f,7.5f), new Vector3(-7.5f,0f,-7.5f), new Vector3(0f,0f,0f), new Vector3(7.5f,0f,0f), new Vector3(-7.5f,0f,0f), new Vector3(0f,0f,7.5f), new Vector3(0f,0f,-7.5f)

};

private Vector3 last =new Vector3(-7.5f,0f,7.5f);

// Use this for initialization

void Start (){

}

// Update is called once per frame

void Update (){

}

void IGUpdate(){

time--;

scoreboard.text="Time: "+ time +"\n"+"Score: "+ score;

if(time <=0){

scoreboard.text="You lose.";

Invoke("Close",3f);

}

}

void Close(){

Debug.Log("Quit");

Application.Quit();

}

void OnTriggerEnter(){

if(!started){

InvokeRepeating ("IGUpdate", 0f, 1f);

started =true;

}

score++;

time =6;

Vector3 newLocation =new Vector3(0, 0, 0);

bool goodLocation =false;

int safety =0;

while(!goodLocation &&(safety <100)){

newLocation = locations [Random.Range(0, 9)];

if(newLocation != last){

goodLocation =true;

}

}

transform.position= newLocation;

last = newLocation;

}

}

/* END SCRIPT */

RAW Paste Data

We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand