Пример #1
0
        void CheckScheduledTasks(double time)
        {
            imageCheckAccumulator += time;
            ticksAccumulator      += time;
            cameraAccumulator     += time;

            if (imageCheckAccumulator > imageCheckPeriod)
            {
                imageCheckAccumulator -= imageCheckPeriod;
                AsyncDownloader.PurgeOldEntries(10);
            }

            int ticksThisFrame = 0;

            while (ticksAccumulator >= ticksPeriod)
            {
                Network.Tick(ticksPeriod);
                Players.Tick(ticksPeriod);
                ParticleManager.Tick(ticksPeriod);
                Animations.Tick(ticksPeriod);
                AudioPlayer.Tick(ticksPeriod);
                BlockHandRenderer.Tick(ticksPeriod);
                ticksThisFrame++;
                ticksAccumulator -= ticksPeriod;
            }

            while (cameraAccumulator >= cameraPeriod)
            {
                Camera.Tick(cameraPeriod);
                cameraAccumulator -= cameraPeriod;
            }

            if (ticksThisFrame > ticksFrequency / 3)
            {
                Utils.LogDebug("Falling behind (did {0} ticks this frame)", ticksThisFrame);
            }
        }
Пример #2
0
 void CameraTick(ScheduledTask task)
 {
     Camera.Tick(task.Interval);
 }