|
|
@ -144,6 +144,8 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
|
|
|
|
|
|
|
|
|
|
|
|
public ulong? PendingSwapRequest { get; set; }
|
|
|
|
public ulong? PendingSwapRequest { get; set; }
|
|
|
|
public int? TargetPlatformId { get; private set; } = null;
|
|
|
|
public int? TargetPlatformId { get; private set; } = null;
|
|
|
|
|
|
|
|
public int? CurrentPlatformId { get; private set; } = null;
|
|
|
|
|
|
|
|
public int? PreviousPlatformId { get; private set; } = null;
|
|
|
|
public bool IsOnAPlatform { get; private set; } = false;
|
|
|
|
public bool IsOnAPlatform { get; private set; } = false;
|
|
|
|
public bool IsCrow { get; private set; } = false;
|
|
|
|
public bool IsCrow { get; private set; } = false;
|
|
|
|
public bool IsSwapping { get; private set; } = false;
|
|
|
|
public bool IsSwapping { get; private set; } = false;
|
|
|
@ -180,18 +182,6 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Debug.LogError("SwapConfirmationPanel not found in the scene!");
|
|
|
|
Debug.LogError("SwapConfirmationPanel not found in the scene!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//// Show the confirmation panel for the specific player
|
|
|
|
|
|
|
|
//var panel = FindObjectOfType<SwapConfirmationPanel>();
|
|
|
|
|
|
|
|
//if (panel != null)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// panel.ShowPanel(this); // Pass the current ServerCharacter reference
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//else
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Debug.LogError("SwapConfirmationPanel not found in the scene!");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -246,23 +236,24 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
|
|
|
|
TargetPlatformId = platformId != -1 ? platformId : (int?)null; // Update the value for all clients
|
|
|
|
TargetPlatformId = platformId != -1 ? platformId : (int?)null; // Update the value for all clients
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnArrivalOnPlatform()
|
|
|
|
public void OnArrivalOnPlatform(int platformId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ClearTargetPlatform();
|
|
|
|
ClearTargetPlatform();
|
|
|
|
SetOnPlatform(true); // Automatically syncs to all clients
|
|
|
|
SetOnPlatform(true, platformId); // Automatically syncs to all clients
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnLeavingPlatform()
|
|
|
|
public void OnLeavingPlatform(int platformId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetOnPlatform(false); // Automatically syncs to all clients
|
|
|
|
|
|
|
|
|
|
|
|
SetOnPlatform(false, platformId); // Automatically syncs to all clients
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetOnPlatform(bool status)
|
|
|
|
public void SetOnPlatform(bool status, int platformId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (IsServer)
|
|
|
|
if (IsServer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IsOnAPlatform = status; // Update on the server
|
|
|
|
IsOnAPlatform = status; // Update on the server
|
|
|
|
UpdatePlatformStatusClientRpc(status); // Notify all clients
|
|
|
|
UpdatePlatformStatusClientRpc(status, platformId); // Notify all clients
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -271,10 +262,19 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ClientRpc]
|
|
|
|
[ClientRpc]
|
|
|
|
private void UpdatePlatformStatusClientRpc(bool status)
|
|
|
|
private void UpdatePlatformStatusClientRpc(bool status, int platformId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IsOnAPlatform = status; // Update the value for all clients
|
|
|
|
IsOnAPlatform = status; // Update the value for all clients
|
|
|
|
IsSwapping = false;
|
|
|
|
IsSwapping = false;
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CurrentPlatformId = platformId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PreviousPlatformId = platformId;
|
|
|
|
|
|
|
|
CurrentPlatformId = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|