Beispiel #1
0
 public override void Update()
 {
     lock (Entitas.EntityWorld.SyncRoot)
     {
         logicBehaviour  = Sim.GetBehaviour <LogicFrameBehaviour>();
         backupBehaviour = Sim.GetBehaviour <ComponentsBackupBehaviour>();
         while (Service.Get <LoginService>().QueueKeyFrameCollection.Count > 0)
         {
             PtKeyFrameCollection pt = null;
             if (Service.Get <LoginService>().QueueKeyFrameCollection.TryPeek(out pt) && pt.FrameIdx < logicBehaviour.CurrentFrameIdx)
             {
                 PtKeyFrameCollection keyframeCollection = null;
                 if (Service.Get <LoginService>().QueueKeyFrameCollection.TryDequeue(out keyframeCollection))
                 {
                     RollImpl(keyframeCollection);
                 }
                 else
                 {
                     break;
                 }
                 //DebugFrameIdx = string.Format("{0} CollectionFrameIdx:{1}", logicBehaviour.CurrentFrameIdx, keyframeCollection.FrameIdx);
             }
             else
             {
                 break;
             }
         }
     }
 }
Beispiel #2
0
        public override void Update()
        {
            lock (Entitas.EntityWorld.SyncRoot)
            {
                logicBehaviour  = Sim.GetBehaviour <LogicFrameBehaviour>();
                backupBehaviour = Sim.GetBehaviour <ComponentsBackupBehaviour>();

                int count = 0;
                while (MgobeHelper.QueueKeyFrameCollection.Count > 0)
                {
                    count++;
                    if (count > MaxCount)
                    {
                        break;
                    }

                    PtKeyFrameCollection pt = null;
                    if (MgobeHelper.QueueKeyFrameCollection.TryPeek(out pt))
                    {
                        PtKeyFrameCollection keyframeCollection = null;
                        if (pt.FrameIdx < logicBehaviour.CurrentFrameIdx)
                        {
                            if (MgobeHelper.QueueKeyFrameCollection.TryDequeue(out keyframeCollection))
                            {
                                RollImpl(keyframeCollection);
                            }
                            else
                            {
                                break;
                            }
                        }
                        else if (pt.FrameIdx > logicBehaviour.CurrentFrameIdx)
                        {
                            if (MgobeHelper.QueueKeyFrameCollection.TryDequeue(out keyframeCollection))
                            {
                                QuickImpl(keyframeCollection);
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }