Preserve flashlight size through aspect adjustment

This commit is contained in:
smoogipoo 2021-09-17 18:51:43 +09:00
parent 2d39131202
commit 35c3d75cb8
1 changed files with 13 additions and 5 deletions

View File

@ -43,13 +43,17 @@ public TaikoFlashlight(TaikoPlayfield taikoPlayfield)
private Vector2 getSizeFor(int combo)
{
Vector2 size;
if (combo > 200)
return new Vector2(0, default_flashlight_size * 0.8f);
size = new Vector2(0, default_flashlight_size * 0.8f);
else if (combo > 100)
size = new Vector2(0, default_flashlight_size * 0.9f);
else
size = new Vector2(0, default_flashlight_size);
if (combo > 100)
return new Vector2(0, default_flashlight_size * 0.9f);
return new Vector2(0, default_flashlight_size);
// Preserve flashlight size through the playfield's aspect adjustment.
return size * taikoPlayfield.DrawHeight / TaikoPlayfield.DEFAULT_HEIGHT;
}
protected override void OnComboChange(ValueChangedEvent<int> e)
@ -66,6 +70,10 @@ protected override void Update()
if (!flashlightProperties.IsValid)
{
FlashlightPosition = ToLocalSpace(taikoPlayfield.HitTarget.ScreenSpaceDrawQuad.Centre);
ClearTransforms(targetMember: nameof(FlashlightSize));
FlashlightSize = getSizeFor(Combo.Value);
flashlightProperties.Validate();
}
}