1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 05:36:05 +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.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mods;
@ -13,7 +12,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects
internal class OsuModTransform : ModWithVisibilityAdjustment
{
public override string Name => "Transform";
public override string Acronym => "TR";
@ -25,11 +24,9 @@ namespace osu.Game.Rulesets.Osu.Mods
private float theta;
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
drawable.ApplyCustomUpdateState += applyTransform;
}
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, state);
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyTransform(hitObject, 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.
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mods;
@ -13,7 +12,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Mods
{
internal class OsuModWiggle : Mod, IApplicableToDrawableHitObjects
internal class OsuModWiggle : ModWithVisibilityAdjustment
{
public override string Name => "Wiggle";
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_strength = 10; // Higher = stronger wiggles
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
{
foreach (var drawable in drawables)
drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState;
}
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => drawableOnApplyCustomUpdateState(hitObject, state);
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
{