mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 01:02:56 +08:00
Implement IEquatable
This commit is contained in:
parent
0220ed21b0
commit
f4fd6189f8
@ -11,7 +11,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
public struct SliderPath
|
||||
public struct SliderPath : IEquatable<SliderPath>
|
||||
{
|
||||
/// <summary>
|
||||
/// The control points of the path.
|
||||
@ -254,5 +254,21 @@ namespace osu.Game.Rulesets.Objects
|
||||
double w = (d - d0) / (d1 - d0);
|
||||
return p0 + (p1 - p0) * (float)w;
|
||||
}
|
||||
|
||||
public bool Equals(SliderPath other)
|
||||
{
|
||||
if (ControlPoints == null && other.ControlPoints != null)
|
||||
return false;
|
||||
if (other.ControlPoints == null && ControlPoints != null)
|
||||
return false;
|
||||
|
||||
return ControlPoints.SequenceEqual(other.ControlPoints) && ExpectedDistance.Equals(other.ExpectedDistance) && Type == other.Type;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj)) return false;
|
||||
return obj is SliderPath other && Equals(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user