mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 08:13:31 +08:00
Simplify creation of repeat points
This commit is contained in:
parent
5b45d36fef
commit
c18fd5da48
@ -151,29 +151,17 @@ 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;
|
|
||||||
|
|
||||||
for (var d = repeatPointDistance; d <= length; d += repeatPointDistance)
|
|
||||||
{
|
{
|
||||||
var repeatStartTime = StartTime + repeat * repeatDuration;
|
var repeatStartTime = StartTime + repeat * repeatDuration;
|
||||||
var distanceProgress = d / length;
|
|
||||||
|
|
||||||
if (sliderStart)
|
|
||||||
distanceProgress = 0;
|
|
||||||
|
|
||||||
AddNested(new RepeatPoint
|
AddNested(new RepeatPoint
|
||||||
{
|
{
|
||||||
RepeatIndex = repeat,
|
RepeatIndex = repeat,
|
||||||
StartTime = repeatStartTime,
|
StartTime = repeatStartTime,
|
||||||
Position = Curve.PositionAt(distanceProgress),
|
Position = Curve.PositionAt(repeat),
|
||||||
StackHeight = StackHeight,
|
StackHeight = StackHeight,
|
||||||
Scale = Scale,
|
Scale = Scale,
|
||||||
ComboColour = ComboColour,
|
ComboColour = ComboColour,
|
||||||
@ -183,4 +171,3 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user