diff --git a/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs b/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs index 35a563e..415e700 100644 --- a/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs +++ b/Assets/Scripts/Gameplay/UI/UIMessageFeed.cs @@ -101,7 +101,7 @@ namespace Unity.BossRoom.Gameplay.UI } } - void DisplayMessage(string text) + public void DisplayMessage(string text) { var messageSlot = GetAvailableSlot(); messageSlot.Display(text); diff --git a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs index c8d6b0f..86cae60 100644 --- a/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs +++ b/Assets/Scripts/Gameplay/UserInput/ClientInputSender.cs @@ -3,6 +3,7 @@ using Unity.BossRoom.Gameplay.Actions; using Unity.BossRoom.Gameplay.Configuration; using Unity.BossRoom.Gameplay.GameplayObjects; using Unity.BossRoom.Gameplay.GameplayObjects.Character; +using Unity.BossRoom.Gameplay.UI; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; @@ -119,7 +120,7 @@ namespace Unity.BossRoom.Gameplay.UserInput public System.Action action1ModifiedCallback; public AbilitySystem m_AbilitySystem; - + public UIMessageFeed m_UIMessageFeed; ServerCharacter m_TargetServerCharacter; private bool IsSwapModeActive = false; @@ -160,6 +161,7 @@ namespace Unity.BossRoom.Gameplay.UserInput m_ActionLayerMask = LayerMask.GetMask(new[] { "PCs", "NPCs", "Ground" }); m_PlatformLayerMask = LayerMask.GetMask(new[]{"Platform"}); m_RaycastHitComparer = new RaycastHitComparer(); + m_UIMessageFeed = FindObjectOfType(); } public override void OnNetworkDespawn() @@ -481,12 +483,13 @@ namespace Unity.BossRoom.Gameplay.UserInput // Toggle Swap Mode with E key if (Input.GetKeyDown(KeyCode.E)) { - if (!m_AbilitySystem.IsAbilityModeActive() && m_ServerCharacter.IsOnAPlatform) // Prevent swap mode if ability mode is active + if (!m_AbilitySystem.IsAbilityModeActive() && m_ServerCharacter.IsOnAPlatform && !m_ServerCharacter.IsCrow) // Prevent swap mode if ability mode is active { ToggleSwapMode(); } else { + m_UIMessageFeed.DisplayMessage("Not on a platform or not a player"); Debug.Log("Cannot activate swap mode while ability mode is active."); } } @@ -497,10 +500,12 @@ namespace Unity.BossRoom.Gameplay.UserInput { if (m_ServerCharacter.IsCrow) // Ensure only the crow can activate the ability { + m_UIMessageFeed.DisplayMessage("Activated Ability mode"); m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.SlowDownAbilityKey); } else { + m_UIMessageFeed.DisplayMessage("Abilities are only for crow"); Debug.Log("You must be the Crow to activate this ability."); } } @@ -538,10 +543,12 @@ namespace Unity.BossRoom.Gameplay.UserInput IsSwapModeActive = !IsSwapModeActive; if (IsSwapModeActive) { + FindObjectOfType().DisplayMessage("Swap mode activated"); Debug.Log("Swap mode activated. Click on a player to request a swap."); } else { + FindObjectOfType().DisplayMessage("Swap mode deactivated"); Debug.Log("Swap mode deactivated."); } }