diff --git a/osu.Game.Mode.Osu/Objects/Slider.cs b/osu.Game.Mode.Osu/Objects/Slider.cs index 90a9ac1f14..b06ae398f4 100644 --- a/osu.Game.Mode.Osu/Objects/Slider.cs +++ b/osu.Game.Mode.Osu/Objects/Slider.cs @@ -4,14 +4,21 @@ using System.Collections.Generic; using osu.Game.Database; using OpenTK; +using osu.Game.Beatmaps; +using System; namespace osu.Game.Modes.Osu.Objects { public class Slider : OsuHitObject { - public override double EndTime => StartTime + RepeatCount * Curve.Length / VelocityAt(StartTime); + public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity; - public double VelocityAt(double time) => 100 / Beatmap.BeatLengthAt(time, true) * Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier; + public double Velocity; + + public override void SetDefaultsFromBeatmap(Beatmap beatmap) + { + Velocity = 100 / beatmap.BeatLengthAt(StartTime, true) * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier; + } public int RepeatCount; diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 7297a78c63..510ba43d4a 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -297,7 +297,7 @@ namespace osu.Game.Beatmaps.Formats if (obj != null) { - obj.Beatmap = beatmap; + obj.SetDefaultsFromBeatmap(beatmap); beatmap.HitObjects.Add(obj); } break; diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index ff352f9321..71839e7036 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -21,8 +21,8 @@ namespace osu.Game.Modes.Objects public double Duration => EndTime - StartTime; - public Beatmap Beatmap; - public HitSampleInfo Sample; + + public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { } } }