Skip to content

Commit

Permalink
Merge pull request #557 from LumpBloom7/lane-sensor-outward-expand
Browse files Browse the repository at this point in the history
Expand lane sensor radius outside the ring
  • Loading branch information
LumpBloom7 authored Feb 21, 2024
2 parents 8d21167 + 6c6b454 commit 94af41e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions osu.Game.Rulesets.Sentakki/UI/Lane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ private void load()

#region Input Handling

private const float receptor_angle_range = 45 * 1.4f;
private const float receptor_angle_range = 45;
private const float receptor_angle_range_mid = receptor_angle_range / 2;

private const float receptor_angle_range_inner = receptor_angle_range * 1.4f;
private const float receptor_angle_range_inner_mid = receptor_angle_range_inner / 2;

private SentakkiInputManager sentakkiActionInputManager = null!;
internal SentakkiInputManager SentakkiActionInputManager => sentakkiActionInputManager ??= (SentakkiInputManager)GetContainingInputManager();

Expand All @@ -78,10 +81,12 @@ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
var localPos = ToLocalSpace(screenSpacePos);

float distance = Vector2.DistanceSquared(Vector2.Zero, localPos);
if (distance is < (200 * 200) or > (400 * 400)) return false;
if (distance is < (200 * 200) or > (600 * 600)) return false;

float targetAngleRangeMid = distance > 400 ? receptor_angle_range_mid : receptor_angle_range_inner_mid;

float angleDelta = SentakkiExtensions.GetDeltaAngle(0, Vector2.Zero.GetDegreesFromPosition(localPos));
if (Math.Abs(angleDelta) > receptor_angle_range_mid) return false;
if (Math.Abs(angleDelta) > targetAngleRangeMid) return false;

return true;
}
Expand Down

0 comments on commit 94af41e

Please sign in to comment.