public void Update(float time)
 {
     if (State == ThreeState.Ready)
     {
         BehaviourSort sort = new BehaviourSort();
         Behaviours.Sort(sort);
         State = ThreeState.Playing;
     }
     if (IsPlaying)
     {
         TimeLine += time;
         if (TimeLine < PrependTime)
         {
             return;
         }
         float timeElappsed = TimeLine - PrependTime;
         bool  completed    = true;
         foreach (BehaviourTimeCallback beh in Behaviours)
         {
             // 只要有一个没执行完,就代表没结束
             if (!beh.IsFinished && beh.Update(timeElappsed))
             {
                 completed = false;
             }
         }
         if (completed && OnCompletedCallback != null)
         {
             State = ThreeState.Finished;
             OnCompletedCallback.Run();
         }
     }
 }
Пример #2
0
 public virtual void End()
 {
     if (EndCallback != null)
     {
         EndCallback.Run();
     }
 }
Пример #3
0
 public virtual void Process()
 {
     if (ProcessCallback != null)
     {
         ProcessCallback.Run();
     }
 }
Пример #4
0
 public virtual void Begin()
 {
     if (BeginCallback != null)
     {
         BeginCallback.Run();
     }
 }
Пример #5
0
 public void OnPathTrigger(AbstractCallback callback)
 {
     if (callback != null)
     {
         callback.Run();
         ObjectPools.Instance.Release(callback);
     }
     DebugUtils.Info("FixedPathMoableTest", "OnPathTrigger AbstractCallback");
 }
Пример #6
0
 public bool Process <T>(T obj)
 {
     Start();
     if (TimeUtils.GetTimeStampSeconds() > mNextSeconds)
     {
         if (mCallback != null)
         {
             mCallback.Run();
         }
         Stop();
         return(true);
     }
     return(false);
 }