使用协程实现比较方便,可以带参数。
void Start(){
StartCoroutine(delayLaunchRocket(rocket,2.0f));
}
IEnumerator delayLaunchRocket(Obj rocket,float delayTime){
yield return new WaitForSeconds (delayTime);
rocket.launch();
}
时间: 2024-10-12 21:03:43
使用协程实现比较方便,可以带参数。
void Start(){
StartCoroutine(delayLaunchRocket(rocket,2.0f));
}
IEnumerator delayLaunchRocket(Obj rocket,float delayTime){
yield return new WaitForSeconds (delayTime);
rocket.launch();
}