unity3d - 在 Unity 中同步时间和动画的问题
问题描述
我的问题是我想根据用户猜测的时间播放不同的动画。由于 Unity 更新的性质,我当前的代码不起作用。不知道如何改变它。不想把它变成协程,因为我必须更改很多以前的代码。将非常感谢您的帮助。
if(userGuessing)
{
timerText.gameObject.SetActive(true);
timer -= Time.deltaTime;
timerText.text = timer.ToString("0.00");
Debug.Log(timer);
}
if(timer > 90)
{
bossArmature.animation.Play("BossVeryHappy", -1);
}
else if(timer > 70 && timer < 90)
{
bossArmature.animation.Play("BossHappy", -1);
}
else if(timer > 50 && timer < 70)
{
bossArmature.animation.Play("BossNeutral", -1);
}
else if(timer > 30 && timer < 50)
{
bossArmature.animation.Play("BossAngry", -1);
}
解决方案
推荐阅读
- pipeline - Dask:构建和执行高效的管道
- python - 如何拟合 sinc 平方函数?
- delphi - Delphi OpenDialog文件名显示问题
- recursion - Prolog:递归后继定义的自然数乘法谓词不终止
- java - 尝试运行 uiautomatorviewer 并收到以下错误:“-Djava.ext.dirs=..\lib\x86_64;..\lib 不受支持。请改用 -classpath。”
- typescript - TypeScript 中的函数链工厂保留输入/输出类型?
- c - C 数组插入/删除
- configuration - 将我的网站 prestashop (1.7.6.1) 从本地服务器转移到 ovh 服务器时出现问题
- c - 就地夹紧/剪辑数字的最佳实践
- bash - 这个差异如何解释?