检查协程是否已完成,然后在完成后调用函数

时间:2017-01-23 15:45:35

标签: c# unity5

 bool isAnimationDone = false;   
 void AnimalSounds(){
    clear ();
    currentAnimation = Instantiate(Resources.Load("Animals/AnimalIntro", typeof(GameObject))) as GameObject;
    StartCoroutine (Animations());

   if(isAnimationDone = true){
      doThis();
 }


}

IEnumerator Animations(){
    yield return new WaitForSeconds (3);
    Destroy (currentAnimation);
    isAnimationDone = true;
    yield break;
}

我目前正在使用协同程序,但我很难处理它们。我只是想将我的动画延迟几秒钟,然后在它被摧毁后调用它。

0 个答案:

没有答案