【发布时间】:2014-10-30 07:44:22
【问题描述】:
我有问题。现在我正在Unity中开发游戏,条件为2分。我想等待十秒钟才能进行代码更改场景(Application.LoadLevel)(我正在使用C#进行开发)
但是这段代码当 score = 2 时会变成“scenea_5” 十秒都等不及了
void OnTriggerEnter( Collider collider ){
if (collider.name == front_hztleft) {
audio.Play ();
}
if (collider.name == left_hztleft) {
audio.Play ();
score ++;
Debug.Log (string.Format (scoreSyntax, score));
endtime = DateTime.Now.ToString("HH:mm:ss");
InsertResult();
}
if (score == 2) {
StartCoroutine(Waiting());
Application.LoadLevel("scene_a5");
}
}
IEnumerator Waiting()
{
yield return new WaitForSeconds (10);
}
它可以运行和编译不是没有错误。
【问题讨论】: