コード例 #1
0
ファイル: GTAnimator.cs プロジェクト: l2xin/graduation-design
 public void Stop(bool clearAllTask = true)
 {
     if (WaittingProcessClips != null)
     {
         WaittingProcessClips.Clear();
     }
     if (ActiveClips.Count > 0)
     {
         for (int i = 0; i < ActiveClips.Count; i++)
         {
             Clip clip = ActiveClips[i];
             if (clip == null)
             {
                 continue;
             }
             clip.OnEnd(this);
         }
         ActiveClips.Clear();
     }
     if (StopDelegate != null)
     {
         StopDelegate(this);
     }
     InternalStop(clearAllTask);
 }
コード例 #2
0
ファイル: GTAnimator.cs プロジェクト: l2xin/graduation-design
 void Update()
 {
     if (IsPlay)
     {
         if (IsPause)
         {
             PauseTime += Time.deltaTime;
             return;
         }
         m_Status     = Status.Updating;
         CurrentTime += (Time.deltaTime * Speed);
         if (UpdateDelegate != null)
         {
             UpdateDelegate(this);
         }
         if (UpdatePercentageDelegate != null)
         {
             UpdatePercentageDelegate(this, 0, CurrentTime);
         }
         if (WaittingProcessClips != null && WaittingProcessClips.Count > 0)
         {
             for (int i = 0; i < WaittingProcessClips.Count; i++)
             {
                 Clip clip = WaittingProcessClips[i];
                 if (clip == null)
                 {
                     WaittingProcessClips.RemoveAt(i);
                     i--;
                     continue;
                 }
                 if (clip.BeginTime <= CurrentTime && clip.m_Status == Clip.Status.UnAction)
                 {
                     clip.OnBegin(this);
                     ActiveClips.Add(clip);
                     WaittingProcessClips.Remove(clip);
                     i--;
                 }
             }
         }
         if (ActiveClips != null && ActiveClips.Count > 0)
         {
             for (int i = 0; i < ActiveClips.Count; i++)
             {
                 Clip clip = ActiveClips[i];
                 if (clip == null)
                 {
                     ActiveClips.RemoveAt(i);
                     i--;
                     continue;
                 }
                 if (clip.EndTime <= CurrentTime)
                 {
                     clip.OnEnd(this);
                     ActiveClips.Remove(clip);
                     i--;
                 }
                 else if (clip.m_Status == Clip.Status.Error)
                 {
                     clip.OnEnd(this);
                     ActiveClips.Remove(clip);
                     i--;
                 }
                 else
                 {
                     clip.OnUpdate(this);
                 }
             }
         }
         if (ActiveClips.Count == 0 && WaittingProcessClips.Count == 0)
         {
             InternalStop();
             return;
         }
     }
 }