From d4d6eecb0e5c12b4f4638947e5fafcdf7a51ff76 Mon Sep 17 00:00:00 2001 From: Fredrik Lillemoen Eiding Date: Mon, 16 Oct 2023 21:58:52 +0200 Subject: [PATCH] Add fix for #228 --- .../Augment/AugmentImplementations/DDRBody.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs b/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs index 2753a87f7..18425f14d 100644 --- a/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs +++ b/Assets/Scripts/Augment/AugmentImplementations/DDRBody.cs @@ -40,6 +40,7 @@ public class DDRBody : GunBody private const float targetHeight = 3; private const float startHeight = targetHeight - screenHeight; + private const float lowestCheckHeight = 2.5f; [SerializeField] private Precision[] precisionsGoodToBad; @@ -126,6 +127,9 @@ private void Fire(InputAction.CallbackContext ctx) private void ArrowSelect(InputAction.CallbackContext ctx) { + if (arrowHeight < lowestCheckHeight) + return; + switch (arrowDirection) { case ArrowDirection.NORTH: @@ -193,7 +197,12 @@ private void ResetArrow() private void OnDestroy() { - if (gunController) - gunController.player.inputManager.onMovePerformed -= ArrowSelect; + if (!gunController) + return; + if (!gunController.player) + return; + + gunController.player.inputManager.onFirePerformed -= Fire; + gunController.player.inputManager.onMovePerformed -= ArrowSelect; } }