From eb4c66732f1cdc531739fb4d9ad97e9bb738632d Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Tue, 17 Dec 2024 22:41:39 +0500 Subject: [PATCH] Fixed a shitty bug --- Assets/Scripts/Gameplay/Platform.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Gameplay/Platform.cs b/Assets/Scripts/Gameplay/Platform.cs index 3596dab..04a2910 100644 --- a/Assets/Scripts/Gameplay/Platform.cs +++ b/Assets/Scripts/Gameplay/Platform.cs @@ -8,7 +8,7 @@ namespace Unity.Multiplayer.Samples.BossRoom public class Platform : NetworkBehaviour { public int PlatformID { get; private set; } - public bool IsOccupied => OccupierId.Value != 0; + public bool IsOccupied{ get; private set; } private NetworkVariable OccupierId = new NetworkVariable(0, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Server); private Collider m_PlatformCollider; @@ -26,6 +26,7 @@ namespace Unity.Multiplayer.Samples.BossRoom public void AssignID(int id) { PlatformID = id; + IsOccupied = false; Debug.Log($"Platform {name} assigned ID: {PlatformID}"); } @@ -43,6 +44,7 @@ namespace Unity.Multiplayer.Samples.BossRoom return; } + IsOccupied = true; OccupierId.Value = player.OwnerClientId; player.SetOnPlatform(true); @@ -63,6 +65,7 @@ namespace Unity.Multiplayer.Samples.BossRoom return; } + IsOccupied = false; OccupierId.Value = 0; player.SetOnPlatform(false);