Hark-the-Moon-Men-Cometh / Assets / Scripts / Animation Scripts / DeathAnimationNotification.cs
DeathAnimationNotification.cs
Raw
using UnityEngine;

public class DeathAnimationNotification : StateMachineBehaviour
{

    AnimatorSupportScript m_animSupport;

    public override void OnStateExit(Animator animator, 
        AnimatorStateInfo stateInfo, int layerIndex)
    {
        //Tells owner when the animation is done, so it can run its death script
        if (m_animSupport == null)
        {
            m_animSupport = animator.GetComponent<AnimatorSupportScript>();
        }
        m_animSupport.r_owner.Die();
    }

    public override void OnStateEnter(Animator animator, 
        AnimatorStateInfo stateInfo, int layerIndex)
    {

    }

}