如何判断Animator动画是否播放完成
答案:1 悬赏:60 手机版
解决时间 2021-03-11 19:32
- 提问者网友:城市野鹿
- 2021-03-11 14:18
如何判断Animator动画是否播放完成
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-03-11 15:50
1. 脚本参考
AnimatorStateInfo.normalizedTime
float normalizedTime;
Description
Normalized time of the State.
The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.
2. 代码如下:
private Animator animator;
void Start()
{
animator = this.GetComponent<Animator>();
}
void Update()
{
AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);
// 判断动画是否播放完成
if( info.normalizedTime >= 1.0f)
{
DoSomething();
}
}
AnimatorStateInfo.normalizedTime
float normalizedTime;
Description
Normalized time of the State.
The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.
2. 代码如下:
private Animator animator;
void Start()
{
animator = this.GetComponent<Animator>();
}
void Update()
{
AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);
// 判断动画是否播放完成
if( info.normalizedTime >= 1.0f)
{
DoSomething();
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯