add wind up and wind down mods

This commit is contained in:
LeNitrous
2019-01-26 12:15:45 +08:00
parent 718136a892
commit c6e26a92ec
17 changed files with 176 additions and 3 deletions

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyIncrease;
public override string Description => "Zoooooooooom...";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime), typeof(ModWindUp) };
public virtual void ApplyToClock(IAdjustableClock clock)
{

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.DifficultyReduction;
public override string Description => "Less zoom...";
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModWindUp) };
public virtual void ApplyToClock(IAdjustableClock clock)
{

View File

@ -0,0 +1,16 @@
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
public class ModWindDown<T> : ModWindUp<T>
where T : HitObject
{
public override string Name => "Wind Down";
public override string Acronym => "WD";
public override string Description => "Slow down.";
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_down;
public override double AppendRate => -0.25;
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Timing;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModWindUp : Mod
{
public override string Name => "Wind Up";
public override string Acronym => "WU";
public override ModType Type => ModType.Fun;
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up;
public override string Description => "Crank it up!";
public override double ScoreMultiplier => 1;
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) };
public abstract double AppendRate { get; }
}
public class ModWindUp<T> : ModWindUp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToRulesetContainer<T>
where T : HitObject
{
private Track Track;
private IAdjustableClock Clock;
private IHasPitchAdjust ClockAdjust;
public override double AppendRate => 0.5;
public virtual void ApplyToClock(IAdjustableClock clock)
{
Clock = clock;
ClockAdjust = clock as IHasPitchAdjust;
}
public virtual void ApplyToRulesetContainer(RulesetContainer<T> ruleset)
{
Track = ruleset.WorkingBeatmap.Track;
}
public virtual void Update(Playfield playfield)
{
double newRate = 1 + (AppendRate * (Track.CurrentTime / Track.Length));
Clock.Rate = newRate;
ClockAdjust.PitchAdjust = newRate;
}
}
}

View File

@ -215,7 +215,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The <see cref="WorkingBeatmap"/> this <see cref="RulesetContainer{TObject}"/> was created with.
/// </summary>
protected readonly WorkingBeatmap WorkingBeatmap;
public readonly WorkingBeatmap WorkingBeatmap;
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor<TObject>(this);