예제 #1
0
        private static float ReplayMultiplier()
        {
            if (!Multiplayer.IsReplay || skipTo >= 0)
            {
                return(1f);
            }

            if (replayTimeSpeed == TimeSpeed.Paused)
            {
                return(0f);
            }

            ITickable tickable = CurrentTickable();

            if (tickable.TimePerTick(tickable.TimeSpeed) == 0f)
            {
                return(1 / 100f); // So paused sections of the timeline are skipped through
            }
            return(tickable.TimePerTick(replayTimeSpeed) / tickable.TimePerTick(tickable.TimeSpeed));
        }
예제 #2
0
        private static void TickTickable(ITickable tickable)
        {
            while (tickable.RealTimeToTickThrough >= 0)
            {
                float timePerTick = tickable.TimePerTick(tickable.TimeSpeed);
                if (timePerTick == 0)
                {
                    break;
                }

                tickable.RealTimeToTickThrough -= timePerTick;

                try
                {
                    tickable.Tick();
                }
                catch (Exception e)
                {
                    Log.Error($"Exception during ticking {tickable}: {e}");
                }
            }
        }