2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
2020-02-08 08:59:35 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-02-10 14:14:04 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2020-03-04 13:51:12 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-02-08 08:59:35 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
|
{
|
2020-02-09 14:54:46 +08:00
|
|
|
|
public class OsuModSpunOut : Mod, IApplicableToDrawableHitObjects
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
public override string Name => "Spun Out";
|
2018-11-30 16:16:00 +08:00
|
|
|
|
public override string Acronym => "SO";
|
2020-01-14 21:22:00 +08:00
|
|
|
|
public override IconUsage? Icon => OsuIcon.ModSpunout;
|
2020-02-09 13:33:43 +08:00
|
|
|
|
public override ModType Type => ModType.Automation;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public override string Description => @"Spinners will be automatically completed.";
|
|
|
|
|
public override double ScoreMultiplier => 0.9;
|
|
|
|
|
public override bool Ranked => true;
|
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
2020-02-08 08:59:35 +08:00
|
|
|
|
|
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
|
{
|
|
|
|
|
foreach (var hitObject in drawables)
|
|
|
|
|
{
|
|
|
|
|
if (hitObject is DrawableSpinner spinner)
|
|
|
|
|
{
|
2020-03-29 13:31:03 +08:00
|
|
|
|
spinner.HandleUserInput = false;
|
|
|
|
|
spinner.OnUpdate += onSpinnerUpdate;
|
2020-02-08 08:59:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-11 04:42:34 +08:00
|
|
|
|
|
2020-03-29 13:31:03 +08:00
|
|
|
|
private void onSpinnerUpdate(Drawable drawable)
|
2020-02-11 04:42:34 +08:00
|
|
|
|
{
|
2020-03-29 13:31:03 +08:00
|
|
|
|
var spinner = (DrawableSpinner)drawable;
|
|
|
|
|
|
2020-07-29 19:01:01 +08:00
|
|
|
|
spinner.RotationTracker.Tracking = true;
|
|
|
|
|
spinner.RotationTracker.AddRotation(MathUtils.RadiansToDegrees((float)spinner.Clock.ElapsedFrameTime * 0.03f));
|
2020-02-11 04:42:34 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|