From b79bb918699e591c31806a3c0df52b15cb2ebd18 Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Tue, 4 Feb 2025 18:31:28 +0500 Subject: [PATCH] Set ability locks for player catogories --- Assets/Scripts/Gameplay/CrowManager.cs | 2 + .../Gameplay/UserInput/ClientInputSender.cs | 41 +++++++++++++------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/Gameplay/CrowManager.cs b/Assets/Scripts/Gameplay/CrowManager.cs index 591f850..1f9003b 100644 --- a/Assets/Scripts/Gameplay/CrowManager.cs +++ b/Assets/Scripts/Gameplay/CrowManager.cs @@ -87,6 +87,7 @@ public class CrowManager : NetworkBehaviour if (currentCrow != null) { + currentCrow.Movement.SetSpeedModifier(1f); currentCrow.SetAsCrow(false); // Clear old crow } @@ -94,6 +95,7 @@ public class CrowManager : NetworkBehaviour currentCrow.SetAsCrow(true); Debug.Log($"{currentCrow.name} is now the Crow."); + currentCrow.Movement.SetSpeedModifier(1.5f); // Notify all clients about the new crow NotifyCrowChangeClientRpc(currentCrow.OwnerClientId); } diff --git a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs index 708711e..16ce456 100644 --- a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs +++ b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs @@ -533,14 +533,29 @@ namespace Unity.BossRoom.Gameplay.UserInput if (Input.GetKeyDown(KeyCode.E)) // Dash'N'Crash { + if (!m_ServerCharacter.IsCrow) + { + m_UIMessageFeed.DisplayMessage("You must be the Crow to activate this ability"); + return; + } ActivateAbilityIfAllowed(GameDataSource.Instance.DashNCrashAbilityKey, "Abilities are only for crow"); } if (Input.GetKeyDown(KeyCode.R)) // Freeze Throw { + if (m_ServerCharacter.IsCrow) + { + m_UIMessageFeed.DisplayMessage("Ability not available for crow"); + return; + } ActivateAbilityIfAllowed(GameDataSource.Instance.FreezeThrowAbilityKey); } if (Input.GetKeyDown(KeyCode.F)) // Vector Wall { + if (m_ServerCharacter.IsCrow) + { + m_UIMessageFeed.DisplayMessage("Ability not available for crow"); + return; + } ActivateAbilityIfAllowed(GameDataSource.Instance.VectorWallAbilityKey); } } @@ -596,19 +611,19 @@ namespace Unity.BossRoom.Gameplay.UserInput return; } - if (abilityKey == GameDataSource.Instance.DashNCrashAbilityKey && !m_ServerCharacter.IsCrow) - { - if (errorMessage != null) - { - m_UIMessageFeed.DisplayMessage(errorMessage); - } - Debug.Log("You must be the Crow to activate this ability."); - return; - } - else - { - Debug.Log("abilitykey: " + abilityKey); - } + // if (abilityKey == GameDataSource.Instance.DashNCrashAbilityKey && !m_ServerCharacter.IsCrow) + // { + // if (errorMessage != null) + // { + // m_UIMessageFeed.DisplayMessage(errorMessage); + // } + // Debug.Log("You must be the Crow to activate this ability."); + // return; + // } + // else + // { + // Debug.Log("abilitykey: " + abilityKey); + // } m_UIMessageFeed.DisplayMessage("Activated Ability mode"); m_AbilitySystem.ActivateAbilityByKey(abilityKey);