diff --git a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs index 9f11a70a66..9ce624ab42 100644 --- a/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Mode.Osu/Objects/Drawables/DrawableSlider.cs @@ -73,11 +73,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables if (repeat % 2 == 1) progress = 1 - progress; - bouncer2.Position = slider.Curve.PositionAt(body.SnakedEnd); + bouncer2.Position = slider.Curve.PositionAt(body.SnakedEnd ?? 0); //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. if (initialCircle.Judgement?.Result != HitResult.Hit) - initialCircle.Position = slider.Curve.PositionAt(body.SnakedStart); + initialCircle.Position = slider.Curve.PositionAt(body.SnakedStart ?? 0); components.ForEach(c => c.UpdateProgress(progress, repeat)); } diff --git a/osu.Game.Mode.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Mode.Osu/Objects/Drawables/Pieces/SliderBody.cs index 002976532f..c0bd29bc02 100644 --- a/osu.Game.Mode.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Mode.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -30,8 +30,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces } } - private double? drawnProgressStart; - private double? drawnProgressEnd; + public double? SnakedStart { get; private set; } + public double? SnakedEnd { get; private set; } private Slider slider; public SliderBody(Slider s) @@ -122,16 +122,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces path.Texture = texture; } - public double SnakedEnd { get; private set; } - public double SnakedStart { get; private set; } - private List currentCurve = new List(); private bool updateSnaking(double p0, double p1) { - if (drawnProgressStart == p0 && drawnProgressEnd == p1) return false; + if (SnakedStart == p0 && SnakedEnd == p1) return false; - drawnProgressStart = p0; - drawnProgressEnd = p1; + SnakedStart = p0; + SnakedEnd = p1; slider.Curve.GetPathToProgress(currentCurve, p0, p1); @@ -144,23 +141,23 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public void UpdateProgress(double progress, int repeat) { - SnakedStart = 0; - SnakedEnd = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1; + double start = 0; + double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1; if (repeat >= slider.RepeatCount - 1) { if (Math.Min(repeat, slider.RepeatCount - 1) % 2 == 1) { - SnakedStart = 0; - SnakedEnd = snakingOut ? progress : 1; + start = 0; + end = snakingOut ? progress : 1; } else { - SnakedStart = snakingOut ? progress : 0; + start = snakingOut ? progress : 0; } } - SetRange(SnakedStart, SnakedEnd); + SetRange(start, end); } } } \ No newline at end of file