1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-09 08:27:25 +08:00

31 lines
1.1 KiB
C#
Raw Normal View History

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