代码语言:javascript复制
public static IEnumerator YieldAniFinish(Animator ani,string aniName, UnityAction action)
{
yield return null;
AnimatorStateInfo stateinfo = ani.GetCurrentAnimatorStateInfo(0);
if (stateinfo.IsName(aniName) && (stateinfo.normalizedTime > 1.0f))
{
action();
}
else
{
Instance.StartCoroutine(YieldAniFinish(ani,aniName, action));
}
}
使用
代码语言:javascript复制StartCoroutine(PublicFunc.YieldAniFinish(m_ani, "Shang", () => { TaskFinish(); }));