我知道你可以做动画。播放()但Animator有类似的东西吗?如果我有:
Animator animator;
void Start()
{
animator = GetComponenet<Animator>();
}
然后我可以去:
void Update()
{
if(Input.GetMouseButtonDown(0))
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
if(!animator.isPlaying("ShootAnimation"))
{
animator.SetTrigger("ShootAnimation"); // play shooting animation
}
}
}
答案 0 :(得分:1)
if (animator.GetCurrentAnimatorStateInfo(0).IsName("YourAnimationName"))
{
// do your magic
}