private void Start()
 {
     animator.AddClipStartCallback(layerIndex, clipName, () =>
     {
         Debug.LogFormat("Clip \"{0}\": started", clipName);
     });
     animator.AddClipEndCallback(layerIndex, clipName, () =>
     {
         Debug.LogFormat("Clip \"{0}\": ended", clipName);
     });
     animator.AddClipCallback(layerIndex, clipName, ExampleTimelinePosition, () =>
     {
         Debug.LogFormat("Clip \"{0}\": callback at {1} seconds after start", clipName, ExampleTimelinePosition);
     });
 }
Exemplo n.º 2
0
 public void AddUpdateEvent(Animator animator, string clipName, Action Callback = null, int layerIndex = 0)
 {
     if (string.IsNullOrEmpty(clipName))
     {
         Debug.Log("AnimatorBase AddAnimatorEvent  parameter is error... ");
         return;
     }
     _UpdateEvent.UpdateCallback = Callback;
     _UpdateEvent.UpdateClipName = clipName;
     _UpdateEvent.UpdateFlag     = true;
     _UpdateEvent.LayerIndex     = layerIndex;
     if (!animator.AddClipEndCallback(clipName, () => { AnimatorUpdateOver(); }, layerIndex))
     {
         AnimatorUpdateOver();
     }
 }
Exemplo n.º 3
0
 private void AddEndCallback()
 {
     animator.AddClipEndCallback(layerIndex, clipName, HandleClipEnded);
 }