Use `switch` for pattern matching

This commit is contained in:
Dean Herbert 2021-07-13 19:37:02 +09:00
parent db8ffc6316
commit 6b663037e4
1 changed files with 8 additions and 6 deletions

View File

@ -70,13 +70,15 @@ public void ApplyToBeatmap(IBeatmap beatmap)
// Move hit objects back into the playfield if they are outside of it // Move hit objects back into the playfield if they are outside of it
Vector2 shift = Vector2.Zero; Vector2 shift = Vector2.Zero;
if (hitObject is HitCircle circle) switch (hitObject)
{ {
shift = clampHitCircleToPlayfield(circle, current); case HitCircle circle:
} shift = clampHitCircleToPlayfield(circle, current);
else if (hitObject is Slider slider) break;
{
shift = clampSliderToPlayfield(slider, current); case Slider slider:
shift = clampSliderToPlayfield(slider, current);
break;
} }
if (shift != Vector2.Zero) if (shift != Vector2.Zero)