1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00
osu-lazer/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
2.6 KiB
C#
Raw Normal View History

// 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
using System;
using osu.Game.Beatmaps.ControlPoints;
2018-04-13 17:19:50 +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="EffectPoint"/>'s SpeedMultiplier.
2017-06-15 13:20:54 +08:00
/// </summary>
public class MultiplierControlPoint : IComparable<MultiplierControlPoint>, IControlPoint
{
/// <summary>
/// The time in milliseconds at which this <see cref="MultiplierControlPoint"/> starts.
/// </summary>
public double Time { get; set; }
2018-04-13 17:19:50 +08:00
/// <summary>
/// The aggregate multiplier which this <see cref="MultiplierControlPoint"/> provides.
/// </summary>
public double Multiplier => Velocity * EffectPoint.ScrollSpeed * BaseBeatLength / TimingPoint.BeatLength;
/// <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>
public double BaseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
/// <summary>
/// The velocity multiplier.
/// </summary>
public double Velocity = 1;
2018-04-13 17:19:50 +08:00
/// <summary>
/// The <see cref="TimingControlPoint"/> that provides the timing information for this <see cref="MultiplierControlPoint"/>.
/// </summary>
public TimingControlPoint TimingPoint = new TimingControlPoint();
2018-04-13 17:19:50 +08:00
/// <summary>
/// The <see cref="EffectControlPoint"/> that provides additional difficulty information for this <see cref="MultiplierControlPoint"/>.
/// </summary>
public EffectControlPoint EffectPoint = new EffectControlPoint();
2018-04-13 17:19:50 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/>. This is required for JSON serialization
/// </summary>
public MultiplierControlPoint()
{
}
2018-04-13 17:19:50 +08:00
/// <summary>
/// Creates a <see cref="MultiplierControlPoint"/>.
/// </summary>
/// <param name="time">The start time of this <see cref="MultiplierControlPoint"/>.</param>
public MultiplierControlPoint(double time)
{
Time = time;
}
2018-04-13 17:19:50 +08:00
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
public int CompareTo(MultiplierControlPoint other) => Time.CompareTo(other?.Time);
}
}