From f3cc730e71b80ede480d5c0bed64abfd7ed60e21 Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Fri, 21 Feb 2025 19:07:17 +0500 Subject: [PATCH] Fixed warning panel --- .../Action/Abilities/The Executioner Ability.asset | 2 +- Assets/Prefabs/Character/PlayerAvatar.prefab | 6 +++--- Assets/Scripts/Gameplay/ExecutionerBox.cs | 5 ++--- .../GameplayObjects/Character/ServerCharacter.cs | 4 +++- Assets/Scripts/Gameplay/WarningPanel.cs | 12 +----------- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Assets/GameData/Action/Abilities/The Executioner Ability.asset b/Assets/GameData/Action/Abilities/The Executioner Ability.asset index c96b375d..60cf3fd2 100644 --- a/Assets/GameData/Action/Abilities/The Executioner Ability.asset +++ b/Assets/GameData/Action/Abilities/The Executioner Ability.asset @@ -22,4 +22,4 @@ MonoBehaviour: prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3} travelTime: 3 spawnRadius: 30 - warningTime: 3 + warningTime: 5 diff --git a/Assets/Prefabs/Character/PlayerAvatar.prefab b/Assets/Prefabs/Character/PlayerAvatar.prefab index 172f2723..9e063eaf 100644 --- a/Assets/Prefabs/Character/PlayerAvatar.prefab +++ b/Assets/Prefabs/Character/PlayerAvatar.prefab @@ -600,7 +600,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5109095020609682098, guid: d3e4ffd5da62ee94e9eccf3ab52ec129, type: 3} propertyPath: GlobalObjectIdHash - value: 3937158934 + value: 2459418115 objectReference: {fileID: 0} - target: {fileID: 5935320730402577130, guid: d3e4ffd5da62ee94e9eccf3ab52ec129, type: 3} propertyPath: m_Name @@ -608,7 +608,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5935320730402577130, guid: d3e4ffd5da62ee94e9eccf3ab52ec129, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -782,7 +782,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4600110157238723790, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} propertyPath: GlobalObjectIdHash - value: 3737985212 + value: 2714313788 objectReference: {fileID: 0} - target: {fileID: 4600110157238723790, guid: 0d2d836e2e83b754fa1a1c4022d6d65d, type: 3} propertyPath: PrefabHashGenerator diff --git a/Assets/Scripts/Gameplay/ExecutionerBox.cs b/Assets/Scripts/Gameplay/ExecutionerBox.cs index c0ce622e..7d615b96 100644 --- a/Assets/Scripts/Gameplay/ExecutionerBox.cs +++ b/Assets/Scripts/Gameplay/ExecutionerBox.cs @@ -2,6 +2,7 @@ using UnityEngine; using Unity.Netcode; using Unity.BossRoom.Gameplay.GameplayObjects.Character; using System.Collections; +using System.Linq; using Unity.BossRoom.Gameplay.GameplayObjects; public class ExecutionerBox : NetworkBehaviour @@ -23,6 +24,7 @@ public class ExecutionerBox : NetworkBehaviour var abilitySystem = serverCharacter.GetComponent(); if (abilitySystem != null) { + WarningPanel.Instance.ShowPanel(2f); abilitySystem.InitiateGlobalCooldown(GameDataSource.Instance.TheExecutionerKey); } break; // Exit loop after finding the local player @@ -46,9 +48,6 @@ public class ExecutionerBox : NetworkBehaviour private IEnumerator StartExecutionerSequence() { - // Show warning UI on all clients - // UIManager.Instance.ShowExecutionerWarning(_warningTime); - WarningPanel.Instance.ShowPanelForTime(_warningTime); // Wait for the warning time before moving yield return new WaitForSeconds(_warningTime); diff --git a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs index 9cfdbf79..860db25d 100644 --- a/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs +++ b/Assets/Scripts/Gameplay/GameplayObjects/Character/ServerCharacter.cs @@ -568,6 +568,7 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character public override void OnNetworkSpawn() { CrowManager.Instance.OnPlayerSpawned(this); + crowModel.SetActive(false); if (!IsServer) { enabled = false; } else { @@ -588,7 +589,8 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character InitializeHitPoints(); } } - + + public override void OnNetworkDespawn() { CrowManager.Instance.OnPlayerDespawned(this); diff --git a/Assets/Scripts/Gameplay/WarningPanel.cs b/Assets/Scripts/Gameplay/WarningPanel.cs index a458f9d9..d4b2b5d1 100644 --- a/Assets/Scripts/Gameplay/WarningPanel.cs +++ b/Assets/Scripts/Gameplay/WarningPanel.cs @@ -20,17 +20,7 @@ public class WarningPanel : NetworkBehaviour Destroy(gameObject); } } - - public void ShowPanelForTime(float seconds) - { - if (IsServer) // Only the server should trigger this - { - ShowPanelClientRpc(seconds); - } - } - - [ClientRpc] - private void ShowPanelClientRpc(float seconds) + public void ShowPanel(float seconds) { panel.SetActive(true); StartCoroutine(HidePanelAfterTime(seconds));