Esempio n. 1
0
 /// <summary>
 /// 添加事件在对应帧数
 /// </summary>
 /// <param name="clip"></param>
 /// <param name="frame"></param>
 /// <param name="action"></param>
 public void AddEventOnFrame(string clip, int frame, UnityAction action,
                             AnimaEventType eventType = AnimaEventType.loop)
 {
     if (Animas.ContainsKey(clip))
     {
         frame.Clamp((int)(Animas[clip].Clip.frameRate * Animas[clip].Clip.length));
         AddEvent(clip, frame / Animas[clip].Clip.frameRate, action, eventType);
     }
     else
     {
         Debug.LogError($"不存在【{clip}】动画");
     }
 }
Esempio n. 2
0
 public void AddEventRatio(string clip, float time, UnityAction action,
                           AnimaEventType eventType = AnimaEventType.loop)
 {
     if (Animas.ContainsKey(clip))
     {
         YuoAnimaEvent animaEvent = new YuoAnimaEvent()
         {
             clip      = Animas[clip].Clip,
             time      = time,
             action    = action,
             eventType = eventType
         };
         Animas[clip].Events.Add(animaEvent);
     }
     else
     {
         Debug.LogError($"不存在【{clip}】动画");
     }
 }