namespace UnityEngine.XR.Content.Animation
{
///
/// Enables a component to react to the 'ActionFinished' animation event.
///
///
public interface IAnimationEventActionFinished
{
void ActionFinished(string label);
}
///
/// Calls the 'ActionFinished' function on any supported component when the target animation exits.
///
///
public class AnimationEventActionFinished : StateMachineBehaviour
{
[SerializeField]
[Tooltip("A label identifying the animation that has finished.")]
string m_Label;
///
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
var eventReceiver = animator.GetComponentInParent();
eventReceiver?.ActionFinished(m_Label);
}
}
}