Add "Barrel Roll" mod

This commit is contained in:
Dean Herbert 2021-04-14 16:52:29 +09:00
parent 7654df94f6
commit a209415942
3 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// 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 osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield
{
[SettingSource("Roll speed", "Speed at which things rotate")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(1)
{
MinValue = 0.1,
MaxValue = 20,
Precision = 0.1,
};
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override double ScoreMultiplier => 1;
public void Update(Playfield playfield)
{
playfield.Rotation = (float)(playfield.Time.Current / 1000 * SpinSpeed.Value);
}
}
}

View File

@ -185,6 +185,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new MultiMod(new OsuModGrow(), new OsuModDeflate()),
new MultiMod(new ModWindUp(), new ModWindDown()),
new OsuModTraceable(),
new OsuModBarrelRoll(),
};
case ModType.System:

View File

@ -42,6 +42,9 @@ public class OsuPlayfield : Playfield
public OsuPlayfield()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
InternalChildren = new Drawable[]
{
playfieldBorder = new PlayfieldBorder { RelativeSizeAxes = Axes.Both },