1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 16:32:59 +08:00

Use class with transform and wiggle mods

This commit is contained in:
smoogipoo 2020-11-05 16:04:42 +09:00
parent cc518feca7
commit f513c95ab2
2 changed files with 8 additions and 14 deletions

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -13,7 +12,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects internal class OsuModTransform : ModWithVisibilityAdjustment
{ {
public override string Name => "Transform"; public override string Name => "Transform";
public override string Acronym => "TR"; public override string Acronym => "TR";
@ -25,11 +24,9 @@ namespace osu.Game.Rulesets.Osu.Mods
private float theta; private float theta;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, state);
{
foreach (var drawable in drawables) protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, state);
drawable.ApplyCustomUpdateState += applyTransform;
}
private void applyTransform(DrawableHitObject drawable, ArmedState state) private void applyTransform(DrawableHitObject drawable, ArmedState state)
{ {

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -13,7 +12,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
internal class OsuModWiggle : Mod, IApplicableToDrawableHitObjects internal class OsuModWiggle : ModWithVisibilityAdjustment
{ {
public override string Name => "Wiggle"; public override string Name => "Wiggle";
public override string Acronym => "WG"; public override string Acronym => "WG";
@ -26,11 +25,9 @@ namespace osu.Game.Rulesets.Osu.Mods
private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles
private const int wiggle_strength = 10; // Higher = stronger wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables) protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
{
foreach (var drawable in drawables) protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState;
}
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
{ {