osu/osu.Game/Rulesets/Mods/ModWindUp.cs

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

53 lines
1.7 KiB
C#
Raw Normal View History

2019-01-26 05:43:27 +00: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.
using System;
using System.Linq;
2019-12-09 10:58:51 +00:00
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
2019-01-26 04:15:45 +00:00
namespace osu.Game.Rulesets.Mods
{
public class ModWindUp : ModTimeRamp
2019-01-26 04:15:45 +00:00
{
public override string Name => "Wind Up";
public override string Acronym => "WU";
public override LocalisableString Description => "Can you keep up?";
2020-01-14 13:22:00 +00:00
public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleUp;
2022-09-25 19:49:22 +00:00
public override BindableNumber<double> InitialRate { get; } = new BindableDouble(1)
{
MinValue = 0.5,
MaxValue = 1.99,
Precision = 0.01,
};
2022-09-25 19:49:22 +00:00
public override BindableNumber<double> FinalRate { get; } = new BindableDouble(1.5)
2019-12-09 10:58:51 +00:00
{
MinValue = 0.51,
2019-12-09 10:58:51 +00:00
MaxValue = 2,
Precision = 0.01,
};
2022-09-25 19:49:22 +00:00
public override BindableBool AdjustPitch { get; } = new BindableBool(true);
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray();
public ModWindUp()
{
InitialRate.BindValueChanged(val =>
{
if (val.NewValue >= FinalRate.Value)
FinalRate.Value = val.NewValue + FinalRate.Precision;
});
FinalRate.BindValueChanged(val =>
{
if (val.NewValue <= InitialRate.Value)
InitialRate.Value = val.NewValue - InitialRate.Precision;
});
}
2019-01-26 04:15:45 +00:00
}
}