1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

Simplify creation of repeat points

This commit is contained in:
smoogipoo 2017-12-27 20:37:28 +09:00
parent 5b45d36fef
commit c18fd5da48

View File

@ -151,35 +151,22 @@ namespace osu.Game.Rulesets.Osu.Objects
private void createRepeatPoints() private void createRepeatPoints()
{ {
var length = Curve.Distance; var repeatDuration = Distance / Velocity;
var repeatPointDistance = Math.Min(Distance, length);
var repeatDuration = length / Velocity;
bool sliderStart = true;
for (var repeat = 1; repeat < RepeatCount; repeat++) for (var repeat = 1; repeat < RepeatCount; repeat++)
{ {
sliderStart = !sliderStart; var repeatStartTime = StartTime + repeat * repeatDuration;
for (var d = repeatPointDistance; d <= length; d += repeatPointDistance) AddNested(new RepeatPoint
{ {
var repeatStartTime = StartTime + repeat * repeatDuration; RepeatIndex = repeat,
var distanceProgress = d / length; StartTime = repeatStartTime,
Position = Curve.PositionAt(repeat),
if (sliderStart) StackHeight = StackHeight,
distanceProgress = 0; Scale = Scale,
ComboColour = ComboColour,
AddNested(new RepeatPoint Samples = new List<SampleInfo>(RepeatSamples[repeat])
{ });
RepeatIndex = repeat,
StartTime = repeatStartTime,
Position = Curve.PositionAt(distanceProgress),
StackHeight = StackHeight,
Scale = Scale,
ComboColour = ComboColour,
Samples = new List<SampleInfo>(RepeatSamples[repeat])
});
}
} }
} }
} }