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