I have a 'Die' animation that's only one frame. So whatever animation at the time the enemy will blend into the 'Die' animation. The problem is I need an event to trigger that the end of the animation but the problem is the Complete event is trigger immediately because it's one frame and doesn't account for the end of the blended animation.
anim.state.Complete += animationComplete;
void animationComplete(TrackEntry trackEntry)
{
if (trackEntry.animation.Name == "hurt") {
anim.state.AddAnimation(0, "normal", true, 0.30f);
}
//die gets called immediately because it's only 1 frame
else if (trackEntry.animation.Name == "die")
{
anim.state.Complete -= animationComplete;
anim.state.Event -= startStep;
anim.enabled = false;
Debug.Log("die");
}
}
What should I use instead?