1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Refactor taiko flashlight a bit

This commit is contained in:
smoogipoo 2021-09-17 18:41:03 +09:00
parent f584d6593a
commit 2d39131202
2 changed files with 10 additions and 9 deletions

View File

@ -36,24 +36,25 @@ namespace osu.Game.Rulesets.Taiko.Mods
public TaikoFlashlight(TaikoPlayfield taikoPlayfield) public TaikoFlashlight(TaikoPlayfield taikoPlayfield)
{ {
this.taikoPlayfield = taikoPlayfield; this.taikoPlayfield = taikoPlayfield;
FlashlightSize = new Vector2(0, getSizeFor(0)); FlashlightSize = getSizeFor(0);
AddLayout(flashlightProperties); AddLayout(flashlightProperties);
} }
private float getSizeFor(int combo) private Vector2 getSizeFor(int combo)
{ {
if (combo > 200) if (combo > 200)
return default_flashlight_size * 0.8f; return new Vector2(0, default_flashlight_size * 0.8f);
else if (combo > 100)
return default_flashlight_size * 0.9f; if (combo > 100)
else return new Vector2(0, default_flashlight_size * 0.9f);
return default_flashlight_size;
return new Vector2(0, default_flashlight_size);
} }
protected override void OnComboChange(ValueChangedEvent<int> e) protected override void OnComboChange(ValueChangedEvent<int> e)
{ {
this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); this.TransformTo(nameof(FlashlightSize), getSizeFor(e.NewValue), FLASHLIGHT_FADE_DURATION);
} }
protected override string FragmentShader => "CircularFlashlight"; protected override string FragmentShader => "CircularFlashlight";

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Mods
public abstract class Flashlight : Drawable public abstract class Flashlight : Drawable
{ {
internal BindableInt Combo; protected internal BindableInt Combo { get; internal set; }
private IShader shader; private IShader shader;
protected override DrawNode CreateDrawNode() => new FlashlightDrawNode(this); protected override DrawNode CreateDrawNode() => new FlashlightDrawNode(this);