Added some stuff

main
Hazim Bin Ijaz 4 weeks ago
parent 18cbadde24
commit 68c64b1293

@ -101,7 +101,7 @@ namespace Unity.BossRoom.Gameplay.UI
} }
} }
void DisplayMessage(string text) public void DisplayMessage(string text)
{ {
var messageSlot = GetAvailableSlot(); var messageSlot = GetAvailableSlot();
messageSlot.Display(text); messageSlot.Display(text);

@ -3,6 +3,7 @@ using Unity.BossRoom.Gameplay.Actions;
using Unity.BossRoom.Gameplay.Configuration; using Unity.BossRoom.Gameplay.Configuration;
using Unity.BossRoom.Gameplay.GameplayObjects; using Unity.BossRoom.Gameplay.GameplayObjects;
using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.BossRoom.Gameplay.GameplayObjects.Character;
using Unity.BossRoom.Gameplay.UI;
using Unity.Netcode; using Unity.Netcode;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
@ -119,7 +120,7 @@ namespace Unity.BossRoom.Gameplay.UserInput
public System.Action action1ModifiedCallback; public System.Action action1ModifiedCallback;
public AbilitySystem m_AbilitySystem; public AbilitySystem m_AbilitySystem;
public UIMessageFeed m_UIMessageFeed;
ServerCharacter m_TargetServerCharacter; ServerCharacter m_TargetServerCharacter;
private bool IsSwapModeActive = false; private bool IsSwapModeActive = false;
@ -160,6 +161,7 @@ namespace Unity.BossRoom.Gameplay.UserInput
m_ActionLayerMask = LayerMask.GetMask(new[] { "PCs", "NPCs", "Ground" }); m_ActionLayerMask = LayerMask.GetMask(new[] { "PCs", "NPCs", "Ground" });
m_PlatformLayerMask = LayerMask.GetMask(new[]{"Platform"}); m_PlatformLayerMask = LayerMask.GetMask(new[]{"Platform"});
m_RaycastHitComparer = new RaycastHitComparer(); m_RaycastHitComparer = new RaycastHitComparer();
m_UIMessageFeed = FindObjectOfType<UIMessageFeed>();
} }
public override void OnNetworkDespawn() public override void OnNetworkDespawn()
@ -481,12 +483,13 @@ namespace Unity.BossRoom.Gameplay.UserInput
// Toggle Swap Mode with E key // Toggle Swap Mode with E key
if (Input.GetKeyDown(KeyCode.E)) 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(); ToggleSwapMode();
} }
else else
{ {
m_UIMessageFeed.DisplayMessage("Not on a platform or not a player");
Debug.Log("Cannot activate swap mode while ability mode is active."); 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 if (m_ServerCharacter.IsCrow) // Ensure only the crow can activate the ability
{ {
m_UIMessageFeed.DisplayMessage("Activated Ability mode");
m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.SlowDownAbilityKey); m_AbilitySystem.ActivateAbilityByKey(GameDataSource.Instance.SlowDownAbilityKey);
} }
else else
{ {
m_UIMessageFeed.DisplayMessage("Abilities are only for crow");
Debug.Log("You must be the Crow to activate this ability."); Debug.Log("You must be the Crow to activate this ability.");
} }
} }
@ -538,10 +543,12 @@ namespace Unity.BossRoom.Gameplay.UserInput
IsSwapModeActive = !IsSwapModeActive; IsSwapModeActive = !IsSwapModeActive;
if (IsSwapModeActive) if (IsSwapModeActive)
{ {
FindObjectOfType<UIMessageFeed>().DisplayMessage("Swap mode activated");
Debug.Log("Swap mode activated. Click on a player to request a swap."); Debug.Log("Swap mode activated. Click on a player to request a swap.");
} }
else else
{ {
FindObjectOfType<UIMessageFeed>().DisplayMessage("Swap mode deactivated");
Debug.Log("Swap mode deactivated."); Debug.Log("Swap mode deactivated.");
} }
} }

Loading…
Cancel
Save