Click to apply a hammer swing animation.
But sometimes the animation doesn’t work and stays idle.
How do I fix it?
private void Update()
{
if (Input.GetMouseButtonDown(0)) Do_BreakIce();
Helper.FollowMouse(gameObject);
}
protected override IEnumerator Connect_Components_Coroutine()
{
spriteRenderer = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
cubicIceManager = Helper.FindGameObject("CubicIceManager").GetComponent<CubicIceManager>();
return base.Connect_Components_Coroutine();
}
private void Do_BreakIce()
{
"Break!!".Log();
StartCoroutine(Break_Coroutine());
}
private IEnumerator Break_Coroutine()
{
animator.SetBool("IsBreak", true);
while (!Helper.Check_AnimationIsFinished(animator, "hammer")) yield return null;
animator.SetBool("IsBreak", false);
}