Update loop logic in line with framework changes

This commit is contained in:
Dean Herbert
2017-07-09 18:23:34 +09:00
parent bde06d466a
commit 2c8b8c3f9c
7 changed files with 68 additions and 144 deletions

View File

@ -23,6 +23,11 @@ namespace osu.Game.Graphics.Containers
/// </summary>
protected double EarlyActivationMilliseconds;
/// <summary>
/// The time in milliseconds until the next beat.
/// </summary>
public double TimeUntilNextBeat { get; private set; }
protected override void Update()
{
if (Beatmap.Value?.Track == null)
@ -42,12 +47,12 @@ namespace osu.Game.Graphics.Containers
if (currentTrackTime < timingPoint.Time)
beatIndex--;
TimeUntilNextBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength;
if (timingPoint == lastTimingPoint && beatIndex == lastBeat)
return;
double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength;
using (BeginDelayedSequence(offsetFromBeat, true))
using (BeginDelayedSequence(TimeUntilNextBeat, true))
OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes);
lastBeat = beatIndex;