Ejemplo n.º 1
0
        protected override void Update()
        {
            if (!GameSession.IsPlaying)
            {
                return;
            }

            curTime = MusicController.CurrentTime;

            // Allocate next frame data
            nextFrame = null;
            if (replayWriter != null)
            {
                nextFrame = replayWriter.NextWriteItem;
                nextFrame?.Reset();
            }

            // Process update for other game modules.
            inputter.UpdateInputs(curTime);
            HitObjectHolder.UpdateObjects(curTime);

            // Record replay frame
            if (nextFrame != null)
            {
                nextFrame.Time = curTime;
                replayWriter.WriteData(nextFrame);
            }
        }
        protected override void Update()
        {
            if (!GameSession.IsPlaying)
            {
                return;
            }

            float musicTime = MusicController.CurrentTime;

            while (true)
            {
                var frame = replayReader.PeekData();
                if (frame == null || frame.Time > musicTime)
                {
                    if (didSkip)
                    {
                        lastFrameTime = musicTime;
                    }
                    break;
                }

                lastFrameTime = frame.Time;
                didSkip       = frame.IsSkipped;

                // Process update for other game modules.
                inputter.UpdateInputs(frame.Time, frame.Inputs);
                HitObjectHolder.UpdateObjects(musicTime);
                UpdateJudgements(frame);

                replayReader.AdvanceIndex();
            }
        }