2019-10-25 18:58:42 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 16:43:03 +08:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.ControlPoints
|
|
|
|
{
|
2019-10-25 16:00:56 +08:00
|
|
|
public abstract class ControlPoint : IComparable<ControlPoint>, IEquatable<ControlPoint>
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The time at which the control point takes effect.
|
|
|
|
/// </summary>
|
2019-10-25 18:48:01 +08:00
|
|
|
public double Time => controlPointGroup?.Time ?? 0;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2019-10-25 18:48:01 +08:00
|
|
|
private ControlPointGroup controlPointGroup;
|
|
|
|
|
2019-11-12 18:24:19 +08:00
|
|
|
public void AttachGroup(ControlPointGroup pointGroup) => controlPointGroup = pointGroup;
|
2019-10-25 18:48:01 +08:00
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
|
|
|
|
2019-10-25 16:00:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Whether this control point is equivalent to another, ignoring time.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="other">Another control point to compare with.</param>
|
|
|
|
/// <returns>Whether equivalent.</returns>
|
|
|
|
public abstract bool EquivalentTo(ControlPoint other);
|
|
|
|
|
|
|
|
public bool Equals(ControlPoint other) => Time.Equals(other?.Time) && EquivalentTo(other);
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|