Fixed a shitty bug

main
Hazim Bin Ijaz 1 month ago
parent 671567bb81
commit eb4c66732f

@ -8,7 +8,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
public class Platform : NetworkBehaviour public class Platform : NetworkBehaviour
{ {
public int PlatformID { get; private set; } public int PlatformID { get; private set; }
public bool IsOccupied => OccupierId.Value != 0; public bool IsOccupied{ get; private set; }
private NetworkVariable<ulong> OccupierId = new NetworkVariable<ulong>(0, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Server); private NetworkVariable<ulong> OccupierId = new NetworkVariable<ulong>(0, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Server);
private Collider m_PlatformCollider; private Collider m_PlatformCollider;
@ -26,6 +26,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
public void AssignID(int id) public void AssignID(int id)
{ {
PlatformID = id; PlatformID = id;
IsOccupied = false;
Debug.Log($"Platform {name} assigned ID: {PlatformID}"); Debug.Log($"Platform {name} assigned ID: {PlatformID}");
} }
@ -43,6 +44,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
return; return;
} }
IsOccupied = true;
OccupierId.Value = player.OwnerClientId; OccupierId.Value = player.OwnerClientId;
player.SetOnPlatform(true); player.SetOnPlatform(true);
@ -63,6 +65,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
return; return;
} }
IsOccupied = false;
OccupierId.Value = 0; OccupierId.Value = 0;
player.SetOnPlatform(false); player.SetOnPlatform(false);

Loading…
Cancel
Save