// Animancer // https://kybernetik.com.au/animancer // Copyright 2021 Kybernetik // using UnityEngine; using UnityEngine.Serialization; namespace Animancer { /// /// A component which uses Animation Events with the Function Name "Event" to trigger a callback. /// /// /// This component must always be attached to the same as the in /// order to receive Animation Events from it. /// /// Documentation: Simple Events /// /// https://kybernetik.com.au/animancer/api/Animancer/SimpleEventReceiver /// [AddComponentMenu(Strings.MenuPrefix + "Simple Event Receiver")] [HelpURL(Strings.DocsURLs.APIDocumentation + "/" + nameof(SimpleEventReceiver))] public class SimpleEventReceiver : MonoBehaviour { /************************************************************************************************************************/ [SerializeField, FormerlySerializedAs("onEvent")] private AnimationEventReceiver _OnEvent; /// [] A callback for Animation Events with the Function Name "Event". public ref AnimationEventReceiver OnEvent => ref _OnEvent; /************************************************************************************************************************/ /// Called by Animation Events with the Function Name "Event". private void Event(AnimationEvent animationEvent) { _OnEvent.SetFunctionName(nameof(Event)); _OnEvent.HandleEvent(animationEvent); } /************************************************************************************************************************/ } }