2018-01-05 19:21:19 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
2017-06-09 15:57:17 +08:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-06-09 18:57:03 +08:00
using System ;
2017-06-09 15:57:17 +08:00
using osu.Game.Beatmaps.ControlPoints ;
2017-06-09 18:57:03 +08:00
using osu.Game.IO.Serialization ;
2017-06-09 15:57:17 +08:00
namespace osu.Game.Rulesets.Timing
{
2017-06-15 13:20:54 +08:00
/// <summary>
/// A control point which adds an aggregated multiplier based on the provided <see cref="TimingPoint"/>'s BeatLength and <see cref="DifficultyPoint"/>'s SpeedMultiplier.
/// </summary>
2017-06-09 18:57:03 +08:00
public class MultiplierControlPoint : IJsonSerializable , IComparable < MultiplierControlPoint >
2017-06-09 15:57:17 +08:00
{
/// <summary>
2017-06-12 14:20:34 +08:00
/// The time in milliseconds at which this <see cref="MultiplierControlPoint"/> starts.
2017-06-09 15:57:17 +08:00
/// </summary>
2018-01-04 17:35:33 +08:00
public double StartTime ;
2017-06-09 15:57:17 +08:00
/// <summary>
2017-06-12 14:20:34 +08:00
/// The multiplier which this <see cref="MultiplierControlPoint"/> provides.
2017-06-09 15:57:17 +08:00
/// </summary>
2017-08-21 10:45:57 +08:00
public double Multiplier = > 1000 / TimingPoint . BeatLength * DifficultyPoint . SpeedMultiplier ;
2017-06-09 15:57:17 +08:00
2017-06-12 14:20:34 +08:00
/// <summary>
/// The <see cref="TimingControlPoint"/> that provides the timing information for this <see cref="MultiplierControlPoint"/>.
/// </summary>
2017-06-09 15:57:17 +08:00
public TimingControlPoint TimingPoint = new TimingControlPoint ( ) ;
2017-06-12 14:20:34 +08:00
/// <summary>
/// The <see cref="DifficultyControlPoint"/> that provides additional difficulty information for this <see cref="MultiplierControlPoint"/>.
/// </summary>
2017-06-09 15:57:17 +08:00
public DifficultyControlPoint DifficultyPoint = new DifficultyControlPoint ( ) ;
2017-06-12 14:20:34 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/>. This is required for JSON serialization
/// </summary>
2017-06-09 18:57:03 +08:00
public MultiplierControlPoint ( )
{
}
2017-06-12 14:20:34 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/>.
/// </summary>
/// <param name="startTime">The start time of this <see cref="MultiplierControlPoint"/>.</param>
2017-06-09 15:57:17 +08:00
public MultiplierControlPoint ( double startTime )
{
StartTime = startTime ;
}
2017-06-09 18:57:03 +08:00
2017-06-12 14:20:34 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/> by copying another <see cref="MultiplierControlPoint"/>.
/// </summary>
/// <param name="startTime">The start time of this <see cref="MultiplierControlPoint"/>.</param>
/// <param name="other">The <see cref="MultiplierControlPoint"/> to copy.</param>
2017-06-09 18:57:03 +08:00
public MultiplierControlPoint ( double startTime , MultiplierControlPoint other )
: this ( startTime )
{
TimingPoint = other . TimingPoint ;
DifficultyPoint = other . DifficultyPoint ;
}
public int CompareTo ( MultiplierControlPoint other ) = > StartTime . CompareTo ( other ? . StartTime ) ;
2017-06-09 15:57:17 +08:00
}
2017-08-21 10:45:57 +08:00
}