1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-19 18:42:54 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Mods/OsuModBarrelRoll.cs

40 lines
1.4 KiB
C#
Raw Normal View History

2021-04-14 15:52:29 +08: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 osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;
2021-04-14 15:52:29 +08:00
using osu.Game.Rulesets.UI;
using osuTK;
2021-04-14 15:52:29 +08:00
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModBarrelRoll : Mod, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
2021-04-14 15:52:29 +08:00
{
[SettingSource("Roll speed", "Rotations per minute")]
public BindableNumber<double> SpinSpeed { get; } = new BindableDouble(0.5)
2021-04-14 15:52:29 +08:00
{
MinValue = 0.02,
MaxValue = 4,
Precision = 0.01,
2021-04-14 15:52:29 +08:00
};
public override string Name => "Barrel Roll";
public override string Acronym => "BR";
public override double ScoreMultiplier => 1;
public void Update(Playfield playfield)
{
playfield.Rotation = 360 * (float)(playfield.Time.Current / 60000 * SpinSpeed.Value);
2021-04-14 15:52:29 +08:00
}
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
// scale the playfield to allow all hitobjects to stay within the visible region.
drawableRuleset.Playfield.Scale = new Vector2(OsuPlayfield.BASE_SIZE.Y / OsuPlayfield.BASE_SIZE.X);
}
2021-04-14 15:52:29 +08:00
}
}