Fix off-by-ones in RepeatPoint code

This commit is contained in:
smoogipoo
2018-01-23 13:58:43 +09:00
parent d37844c068
commit 33c52ba30f
4 changed files with 12 additions and 12 deletions

View File

@ -72,6 +72,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
public void UpdateSnakingPosition(Vector2 start, Vector2 end) => Position = repeatPoint.RepeatIndex % 2 == 1 ? end : start;
public void UpdateSnakingPosition(Vector2 start, Vector2 end) => Position = repeatPoint.RepeatIndex % 2 == 0 ? end : start;
}
}

View File

@ -73,12 +73,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddNested(InitialCircle);
var repeatDuration = s.Curve.Distance / s.Velocity;
var spanDuration = s.Curve.Distance / s.Velocity;
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
{
var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration;
var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = repeatStartTime + repeatDuration;
var spanStartTime = s.StartTime + tick.SpanIndex * spanDuration;
var fadeInTime = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = spanStartTime + spanDuration;
var drawableTick = new DrawableSliderTick(tick)
{
@ -93,9 +93,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var repeatPoint in s.NestedHitObjects.OfType<RepeatPoint>())
{
var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration;
var repeatStartTime = s.StartTime + (repeatPoint.RepeatIndex + 1) * spanDuration;
var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = repeatStartTime + repeatDuration;
var fadeOutTime = repeatStartTime + spanDuration;
var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
{