mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +00:00
59 lines
1.9 KiB
C#
59 lines
1.9 KiB
C#
// 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.
|
|
|
|
using System;
|
|
using System.Linq;
|
|
using osu.Framework.Bindables;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Game.Configuration;
|
|
|
|
namespace osu.Game.Rulesets.Mods
|
|
{
|
|
public class ModWindDown : ModTimeRamp
|
|
{
|
|
public override string Name => "Wind Down";
|
|
public override string Acronym => "WD";
|
|
public override string Description => "Sloooow doooown...";
|
|
public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleDown;
|
|
public override double ScoreMultiplier => 1.0;
|
|
|
|
[SettingSource("Initial rate", "The starting speed of the track")]
|
|
public override BindableNumber<double> InitialRate { get; } = new BindableDouble
|
|
{
|
|
MinValue = 0.5,
|
|
MaxValue = 2,
|
|
Default = 1,
|
|
Value = 1,
|
|
Precision = 0.01,
|
|
};
|
|
|
|
[SettingSource("Final rate", "The speed increase to ramp towards")]
|
|
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
|
|
{
|
|
MinValue = 0.5,
|
|
MaxValue = 2,
|
|
Default = 0.75,
|
|
Value = 0.75,
|
|
Precision = 0.01,
|
|
};
|
|
|
|
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
|
|
public override BindableBool AdjustPitch { get; } = new BindableBool
|
|
{
|
|
Default = true,
|
|
Value = true
|
|
};
|
|
|
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
|
|
|
|
public ModWindDown()
|
|
{
|
|
InitialRate.BindValueChanged(val =>
|
|
InitialRate.Value = Math.Max(val.NewValue, FinalRate.Value + 0.01));
|
|
|
|
FinalRate.BindValueChanged(val =>
|
|
FinalRate.Value = Math.Min(val.NewValue, InitialRate.Value - 0.01));
|
|
}
|
|
}
|
|
}
|