Simplify flashlight parameter passing flow

This commit is contained in:
Bartłomiej Dach
2022-01-24 20:55:24 +01:00
parent 5874475dff
commit a227af75ed
5 changed files with 37 additions and 40 deletions

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Mods
public override float DefaultFlashlightSize => 350;
public override Flashlight CreateFlashlight() => new CatchFlashlight(playfield, ComboBasedSize.Value, SizeMultiplier.Value, DefaultFlashlightSize);
protected override Flashlight CreateFlashlight() => new CatchFlashlight(this, playfield);
private CatchPlayfield playfield;
@ -49,11 +49,11 @@ namespace osu.Game.Rulesets.Catch.Mods
{
private readonly CatchPlayfield playfield;
public CatchFlashlight(CatchPlayfield playfield, bool isRadiusBasedOnCombo, float initialRadius, float defaultFlashlightSize)
: base(isRadiusBasedOnCombo, initialRadius, defaultFlashlightSize)
public CatchFlashlight(CatchModFlashlight modFlashlight, CatchPlayfield playfield)
: base(modFlashlight)
{
this.playfield = playfield;
FlashlightSize = new Vector2(0, GetRadiusFor(0));
FlashlightSize = new Vector2(0, GetSizeFor(0));
}
protected override void Update()
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Mods
protected override void OnComboChange(ValueChangedEvent<int> e)
{
this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetRadiusFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
this.TransformTo(nameof(FlashlightSize), new Vector2(0, GetSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION);
}
protected override string FragmentShader => "CircularFlashlight";