mirror of
https://github.com/osukey/osukey.git
synced 2025-06-09 13:28:03 +09:00
Simplify variables for snake start/end.
This commit is contained in:
parent
2ba77746c0
commit
41b9a55460
@ -73,11 +73,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
if (repeat % 2 == 1)
|
if (repeat % 2 == 1)
|
||||||
progress = 1 - progress;
|
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.
|
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
|
||||||
if (initialCircle.Judgement?.Result != HitResult.Hit)
|
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));
|
components.ForEach(c => c.UpdateProgress(progress, repeat));
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double? drawnProgressStart;
|
public double? SnakedStart { get; private set; }
|
||||||
private double? drawnProgressEnd;
|
public double? SnakedEnd { get; private set; }
|
||||||
|
|
||||||
private Slider slider;
|
private Slider slider;
|
||||||
public SliderBody(Slider s)
|
public SliderBody(Slider s)
|
||||||
@ -122,16 +122,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|||||||
path.Texture = texture;
|
path.Texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double SnakedEnd { get; private set; }
|
|
||||||
public double SnakedStart { get; private set; }
|
|
||||||
|
|
||||||
private List<Vector2> currentCurve = new List<Vector2>();
|
private List<Vector2> currentCurve = new List<Vector2>();
|
||||||
private bool updateSnaking(double p0, double p1)
|
private bool updateSnaking(double p0, double p1)
|
||||||
{
|
{
|
||||||
if (drawnProgressStart == p0 && drawnProgressEnd == p1) return false;
|
if (SnakedStart == p0 && SnakedEnd == p1) return false;
|
||||||
|
|
||||||
drawnProgressStart = p0;
|
SnakedStart = p0;
|
||||||
drawnProgressEnd = p1;
|
SnakedEnd = p1;
|
||||||
|
|
||||||
slider.Curve.GetPathToProgress(currentCurve, p0, 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)
|
public void UpdateProgress(double progress, int repeat)
|
||||||
{
|
{
|
||||||
SnakedStart = 0;
|
double start = 0;
|
||||||
SnakedEnd = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1;
|
double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1;
|
||||||
|
|
||||||
if (repeat >= slider.RepeatCount - 1)
|
if (repeat >= slider.RepeatCount - 1)
|
||||||
{
|
{
|
||||||
if (Math.Min(repeat, slider.RepeatCount - 1) % 2 == 1)
|
if (Math.Min(repeat, slider.RepeatCount - 1) % 2 == 1)
|
||||||
{
|
{
|
||||||
SnakedStart = 0;
|
start = 0;
|
||||||
SnakedEnd = snakingOut ? progress : 1;
|
end = snakingOut ? progress : 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SnakedStart = snakingOut ? progress : 0;
|
start = snakingOut ? progress : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetRange(SnakedStart, SnakedEnd);
|
SetRange(start, end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user