mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
allow setting initial rate instead of reversing
This commit is contained in:
parent
12b9e8146e
commit
7f538cfa74
@ -20,12 +20,12 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// </summary>
|
||||
private const double final_rate_progress = 0.75f;
|
||||
|
||||
[SettingSource("Initial rate", "The starting speed of the track")]
|
||||
public abstract BindableNumber<double> InitialRate { get; }
|
||||
|
||||
[SettingSource("Final rate", "The final speed to ramp to")]
|
||||
public abstract BindableNumber<double> FinalRate { get; }
|
||||
|
||||
[SettingSource("Start wounded", "Start at 100% of the final rate")]
|
||||
public BindableBool Reverse { get; } = new BindableBool();
|
||||
|
||||
private double finalRateTime;
|
||||
private double beginRampTime;
|
||||
|
||||
@ -64,10 +64,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public virtual void Update(Playfield playfield)
|
||||
{
|
||||
if (!Reverse.Value)
|
||||
applyAdjustment((track.CurrentTime - beginRampTime) / finalRateTime);
|
||||
else
|
||||
applyAdjustment(1 - ((track.CurrentTime - beginRampTime) / finalRateTime));
|
||||
applyAdjustment((track.CurrentTime - beginRampTime) / finalRateTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -75,6 +72,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// </summary>
|
||||
/// <param name="amount">The amount of adjustment to apply (from 0..1).</param>
|
||||
private void applyAdjustment(double amount) =>
|
||||
SpeedChange.Value = 1 + (FinalRate.Value - 1) * Math.Clamp(amount, 0, 1);
|
||||
// SpeedChange.Value = 1 + (FinalRate.Value - 1) * Math.Clamp(amount, 0, 1);
|
||||
SpeedChange.Value = InitialRate.Value + (FinalRate.Value - InitialRate.Value) * Math.Clamp(amount, 0, 1);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,16 @@ namespace osu.Game.Rulesets.Mods
|
||||
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 = 1,
|
||||
MaxValue = 1.5,
|
||||
Default = 1,
|
||||
Value = 1,
|
||||
Precision = 0.01,
|
||||
};
|
||||
|
||||
[SettingSource("Final rate", "The speed increase to ramp towards")]
|
||||
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
|
||||
{
|
||||
|
@ -17,6 +17,16 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleUp;
|
||||
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 = 1,
|
||||
Default = 1,
|
||||
Value = 1,
|
||||
Precision = 0.01,
|
||||
};
|
||||
|
||||
[SettingSource("Final rate", "The speed increase to ramp towards")]
|
||||
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user