Make Path.Distance a property again

This commit is contained in:
smoogipoo 2018-11-12 14:07:48 +09:00
parent 3b88d94793
commit 3aba462e52
4 changed files with 9 additions and 9 deletions

View File

@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Catch.Objects
if (TickDistance == 0) if (TickDistance == 0)
return; return;
var length = Path.GetDistance(); var length = Path.Distance;
var tickDistance = Math.Min(TickDistance, length); var tickDistance = Math.Min(TickDistance, length);
var spanDuration = length / Velocity; var spanDuration = length / Velocity;
@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Catch.Objects
} }
} }
public double EndTime => StartTime + this.SpanCount() * Path.GetDistance() / Velocity; public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH; public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH;
@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Catch.Objects
set => path = value; set => path = value;
} }
public double Distance => Path.GetDistance(); public double Distance => Path.Distance;
public List<List<SampleInfo>> NodeSamples { get; set; } = new List<List<SampleInfo>>(); public List<List<SampleInfo>> NodeSamples { get; set; } = new List<List<SampleInfo>>();

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public event Action<SliderPath> PathChanged; public event Action<SliderPath> PathChanged;
public double EndTime => StartTime + this.SpanCount() * Path.GetDistance() / Velocity; public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t); public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Objects
} }
} }
public double Distance => Path.GetDistance(); public double Distance => Path.Distance;
public override Vector2 Position public override Vector2 Position
{ {
@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.Osu.Objects
private void createTicks() private void createTicks()
{ {
var length = Path.GetDistance(); var length = Path.Distance;
var tickDistance = MathHelper.Clamp(TickDistance, 0, length); var tickDistance = MathHelper.Clamp(TickDistance, 0, length);
if (tickDistance == 0) return; if (tickDistance == 0) return;

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
/// </summary> /// </summary>
public SliderPath Path { get; set; } public SliderPath Path { get; set; }
public double Distance => Path.GetDistance(); public double Distance => Path.Distance;
public List<List<SampleInfo>> NodeSamples { get; set; } public List<List<SampleInfo>> NodeSamples { get; set; }
public int RepeatCount { get; set; } public int RepeatCount { get; set; }

View File

@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Objects
private double progressToDistance(double progress) private double progressToDistance(double progress)
{ {
return MathHelper.Clamp(progress, 0, 1) * GetDistance(); return MathHelper.Clamp(progress, 0, 1) * Distance;
} }
private Vector2 interpolateVertices(int i, double d) private Vector2 interpolateVertices(int i, double d)
@ -164,7 +164,7 @@ namespace osu.Game.Rulesets.Objects
return p0 + (p1 - p0) * (float)w; return p0 + (p1 - p0) * (float)w;
} }
public double GetDistance() => cumulativeLength.Count == 0 ? 0 : cumulativeLength[cumulativeLength.Count - 1]; public double Distance => cumulativeLength.Count == 0 ? 0 : cumulativeLength[cumulativeLength.Count - 1];
/// <summary> /// <summary>
/// Computes the slider path until a given progress that ranges from 0 (beginning of the slider) /// Computes the slider path until a given progress that ranges from 0 (beginning of the slider)