2019-01-24 16:43:03 +08: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 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2017-06-09 18:57:03 +08:00
using System ;
2017-06-09 15:57:17 +08:00
using osu.Game.Beatmaps.ControlPoints ;
2018-04-13 17:19:50 +08:00
2017-06-09 15:57:17 +08:00
namespace osu.Game.Rulesets.Timing
{
2017-06-15 13:20:54 +08:00
/// <summary>
2021-09-01 17:19:25 +08:00
/// A control point which adds an aggregated multiplier based on the provided <see cref="TimingPoint"/>'s BeatLength and <see cref="EffectPoint"/>'s SpeedMultiplier.
2017-06-15 13:20:54 +08:00
/// </summary>
2022-10-18 15:01:04 +08:00
public class MultiplierControlPoint : IComparable < MultiplierControlPoint > , IControlPoint
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>
2022-10-18 15:01:04 +08:00
public double Time { get ; set ; }
2018-04-13 17:19:50 +08:00
2017-06-09 15:57:17 +08:00
/// <summary>
2018-10-01 17:12:26 +08:00
/// The aggregate multiplier which this <see cref="MultiplierControlPoint"/> provides.
2017-06-09 15:57:17 +08:00
/// </summary>
2021-09-06 13:56:34 +08:00
public double Multiplier = > Velocity * EffectPoint . ScrollSpeed * BaseBeatLength / TimingPoint . BeatLength ;
2019-08-26 11:51:13 +08:00
/// <summary>
/// The base beat length to scale the <see cref="TimingPoint"/> provided multiplier relative to.
/// </summary>
/// <example>For a <see cref="BaseBeatLength"/> of 1000, a <see cref="TimingPoint"/> with a beat length of 500 will increase the multiplier by 2.</example>
2019-08-28 19:22:16 +08:00
public double BaseBeatLength = TimingControlPoint . DEFAULT_BEAT_LENGTH ;
2018-10-01 17:12:26 +08:00
/// <summary>
/// The velocity multiplier.
/// </summary>
public double Velocity = 1 ;
2018-04-13 17:19:50 +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 ( ) ;
2018-04-13 17:19:50 +08:00
2017-06-12 14:20:34 +08:00
/// <summary>
2021-09-01 17:19:25 +08:00
/// The <see cref="EffectControlPoint"/> that provides additional difficulty information for this <see cref="MultiplierControlPoint"/>.
2017-06-12 14:20:34 +08:00
/// </summary>
2021-09-01 17:19:25 +08:00
public EffectControlPoint EffectPoint = new EffectControlPoint ( ) ;
2018-04-13 17:19:50 +08:00
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 ( )
{
}
2018-04-13 17:19:50 +08:00
2017-06-12 14:20:34 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/>.
/// </summary>
2022-10-18 15:01:04 +08:00
/// <param name="time">The start time of this <see cref="MultiplierControlPoint"/>.</param>
public MultiplierControlPoint ( double time )
2017-06-09 15:57:17 +08:00
{
2022-10-18 15:01:04 +08:00
Time = time ;
2017-06-09 15:57:17 +08:00
}
2018-04-13 17:19:50 +08:00
2017-11-20 17:55:48 +08:00
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
2022-10-18 15:01:04 +08:00
public int CompareTo ( MultiplierControlPoint other ) = > Time . CompareTo ( other ? . Time ) ;
2017-06-09 15:57:17 +08:00
}
2017-08-21 10:45:57 +08:00
}