Result:
Enemy Original (1) d 352
Enemy Original (1) i 352
As you can see, the character start defend animation, but the defend animation have not start yet, and character is still in Idle animation (actionMode become Idle immediately in the same frame)
Any suggestion?
void FixedUpdate()
{
switch (actionMode)
{
case UnitActionMode.Idle:
break;
case UnitActionMode.Melee:
if (animator.GetCurrentAnimatorStateInfo(currentAnimationLayer).IsName("Idle"))
actionMode = UnitActionMode.Idle;
break;
case UnitActionMode.GetHit:
if (animator.GetCurrentAnimatorStateInfo(currentAnimationLayer).IsName("Idle"))
actionMode = UnitActionMode.Idle;
break;
case UnitActionMode.Defend:
if (animator.GetCurrentAnimatorStateInfo(currentAnimationLayer).IsName("Idle"))
{
Debug.Log(transform.name + " i " + Time.frameCount);
actionMode = UnitActionMode.Idle;
animator.applyRootMotion = false;
}
break;
}
}
public void Defend()
{
if (actionMode == UnitActionMode.Idle)
{
Debug.Log(transform.name + " d " + Time.frameCount);
animator.applyRootMotion = true;
animator.Play(_unarmed_Strafe_Back);
actionMode = UnitActionMode.Defend;
}
}