From e1b8487bf9ed2e6ac02f8130fccad070406a4270 Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Thu, 13 Mar 2025 15:06:53 +0500 Subject: [PATCH] Fixed a few issues --- .../RuntimeDataContainers/GameDataSource.cs | 4 ++++ .../Gameplay/UserInput/ClientInputSender.cs | 20 ++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs index eb9600ee..d4b4b9f1 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/RuntimeDataContainers/GameDataSource.cs @@ -146,6 +146,10 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects DontDestroyOnLoad(gameObject); Instance = this; +#if UNITY_ANDROID|| UNITY_IOS + Screen.sleepTimeout = SleepTimeout.NeverSleep; +#endif + } void BuildActionIDs() diff --git a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs index 00dba5ec..f3256c66 100644 --- a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs +++ b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs @@ -547,7 +547,7 @@ namespace Unity.BossRoom.Gameplay.UserInput bool SwapKeyPressed = false; private void HandleSwapInput() { - if (Input.GetKeyDown(KeyCode.Q) || CnInputManager.GetButtonDown("Swap")) + if (Input.GetKeyDown(KeyCode.Q)) { if (CanActivateSwapMode()) { @@ -568,8 +568,7 @@ namespace Unity.BossRoom.Gameplay.UserInput private void HandleAbilityInput() { - //if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash - if (CnInputManager.GetButtonDown(GameDataSource.Instance.DashNCrashAbilityKey) || Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash + if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash { if (!m_ServerCharacter.IsCrow) { @@ -578,7 +577,7 @@ namespace Unity.BossRoom.Gameplay.UserInput } ActivateAbilityIfAllowed(GameDataSource.Instance.DashNCrashAbilityKey, "Abilities are only for crow"); } - if (CnInputManager.GetButtonDown(GameDataSource.Instance.FreezeThrowAbilityKey) || Input.GetKeyDown(KeyCode.R)) // Freeze Throw + if (Input.GetKeyDown(KeyCode.R)) // Freeze Throw { if (m_ServerCharacter.IsCrow) { @@ -587,11 +586,11 @@ namespace Unity.BossRoom.Gameplay.UserInput } ActivateAbilityIfAllowed(GameDataSource.Instance.FreezeThrowAbilityKey); } - if (CnInputManager.GetButtonDown(GameDataSource.Instance.VectorWallAbilityKey) || Input.GetKeyDown(KeyCode.F)) // Vector Wall + if (Input.GetKeyDown(KeyCode.F)) // Vector Wall { ActivateAbilityIfAllowed(GameDataSource.Instance.VectorWallAbilityKey); } - if (CnInputManager.GetButtonDown(GameDataSource.Instance.TheExecutionerKey) || Input.GetKeyDown(KeyCode.C)) // The Executioner + if (Input.GetKeyDown(KeyCode.C)) // The Executioner { if (m_ServerCharacter.IsCrow) { @@ -600,7 +599,7 @@ namespace Unity.BossRoom.Gameplay.UserInput } ActivateAbilityIfAllowed(GameDataSource.Instance.TheExecutionerKey); } - if (CnInputManager.GetButtonDown(GameDataSource.Instance.CrowsForesightKey) || Input.GetKeyDown(KeyCode.V)) // Crow's Foresight + if (Input.GetKeyDown(KeyCode.V)) // Crow's Foresight { if (!m_ServerCharacter.IsCrow) { @@ -613,7 +612,7 @@ namespace Unity.BossRoom.Gameplay.UserInput private void HandleSprint() { if (m_ServerCharacter.IsCrow) return; - if (CnInputManager.GetButtonDown("Sprint") || Input.GetKey(KeyCode.LeftShift)) + if (Input.GetKey(KeyCode.LeftShift)) { float staminaCost = 50f * Time.deltaTime; @@ -621,6 +620,7 @@ namespace Unity.BossRoom.Gameplay.UserInput { if (!isSprinting) { + isSprinting = true; StartSprintServerRPC(); } } @@ -628,10 +628,12 @@ namespace Unity.BossRoom.Gameplay.UserInput { StopSprintServerRPC(); staminaManager.StopConsuming(); // Allows regen after delay + isSprinting = false; } } else if (isSprinting) // Sprint key released { + isSprinting = false; StopSprintServerRPC(); staminaManager.StopConsuming(); // Allows regen after delay } @@ -816,7 +818,7 @@ namespace Unity.BossRoom.Gameplay.UserInput private void HandleMobileSprint() { - //if (m_ServerCharacter.IsCrow) return; + if (m_ServerCharacter.IsCrow) return; if (CnInputManager.GetButton(GameDataSource.Instance.SprintButtonKey)) { float staminaCost = 50f * Time.deltaTime;