diff --git a/Assets/Scripts/Characters/Arrow.cs b/Assets/Scripts/Characters/Arrow.cs index ecae455..8c58edc 100644 --- a/Assets/Scripts/Characters/Arrow.cs +++ b/Assets/Scripts/Characters/Arrow.cs @@ -1,19 +1,22 @@ using UnityEngine; +using UnityEngine.InputSystem; public class Arrow : MonoBehaviour { [SerializeField] private bool _forceEnable; + private void Awake() { if (_forceEnable) { return; } - - if (Application.platform != RuntimePlatform.Android && - Application.platform != RuntimePlatform.IPhonePlayer) - { - gameObject.SetActive(false); - } + + // Show arrow on mobile platforms or when a gamepad is connected + bool shouldShowArrow = Application.platform == RuntimePlatform.Android || + Application.platform == RuntimePlatform.IPhonePlayer || + Gamepad.current != null; + + gameObject.SetActive(shouldShowArrow); } } diff --git a/Assets/Scripts/SceneManagers/BattleSceneManager.cs b/Assets/Scripts/SceneManagers/BattleSceneManager.cs index 15b6628..5d3dbbf 100644 --- a/Assets/Scripts/SceneManagers/BattleSceneManager.cs +++ b/Assets/Scripts/SceneManagers/BattleSceneManager.cs @@ -463,6 +463,12 @@ private void SetCurrentLevel(int level) public void OnPause() { + // Don't allow pausing if the level up UI is active (it already pauses the game) + if (_levelUpUI.activeSelf) + { + return; + } + if (_gameState == GameState.Playing) { PauseGame(); diff --git a/Assets/Scripts/SceneManagers/HUDManager.cs b/Assets/Scripts/SceneManagers/HUDManager.cs index dfb01ae..f8f09cf 100644 --- a/Assets/Scripts/SceneManagers/HUDManager.cs +++ b/Assets/Scripts/SceneManagers/HUDManager.cs @@ -23,12 +23,20 @@ private void Awake() _navigateAction = InputSystem.actions.FindAction("Navigate"); _submitAction = InputSystem.actions.FindAction("Submit"); - // Subscribe to the performed callback only + // Subscribe to input events + _navigateAction.performed += OnNavigatePerformed; _submitAction.performed += OnSubmitPerformed; _tryAgainHighlighter = tryAgainButton.GetComponent(); _quitHighlighter = quitButton.GetComponent(); } + + private void OnDestroy() + { + // Unsubscribe from input events + _navigateAction.performed -= OnNavigatePerformed; + _submitAction.performed -= OnSubmitPerformed; + } private void OnSubmitPerformed(InputAction.CallbackContext context) { @@ -37,10 +45,14 @@ private void OnSubmitPerformed(InputAction.CallbackContext context) return; } - _highlightedButton?.GetComponent