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;
}
我目前正在使用协同程序,但我很难处理它们。我只是想将我的动画延迟几秒钟,然后在它被摧毁后调用它。