|
|
|
@ -192,35 +192,86 @@ namespace Unity.BossRoom.Gameplay.GameplayObjects.Character
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetAsCrow(bool status)
|
|
|
|
|
{
|
|
|
|
|
IsCrow = status;
|
|
|
|
|
if (IsServer)
|
|
|
|
|
{
|
|
|
|
|
IsCrow = status; // Update on the server
|
|
|
|
|
UpdateCrowStatusClientRpc(status); // Notify all clients
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("SetAsCrow should only be called on the server.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ClientRpc]
|
|
|
|
|
private void UpdateCrowStatusClientRpc(bool status)
|
|
|
|
|
{
|
|
|
|
|
IsCrow = status; // Update the value for all clients
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetTargetPlatform(int platformId)
|
|
|
|
|
{
|
|
|
|
|
TargetPlatformId = platformId;
|
|
|
|
|
if (IsServer)
|
|
|
|
|
{
|
|
|
|
|
TargetPlatformId = platformId; // Update on the server
|
|
|
|
|
UpdateTargetPlatformClientRpc(platformId); // Notify all clients
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("SetTargetPlatform should only be called on the server.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClearTargetPlatform()
|
|
|
|
|
{
|
|
|
|
|
TargetPlatformId = null;
|
|
|
|
|
if (IsServer)
|
|
|
|
|
{
|
|
|
|
|
TargetPlatformId = null; // Update on the server
|
|
|
|
|
UpdateTargetPlatformClientRpc(-1); // Notify all clients (use -1 to indicate no platform)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("ClearTargetPlatform should only be called on the server.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ClientRpc]
|
|
|
|
|
private void UpdateTargetPlatformClientRpc(int platformId)
|
|
|
|
|
{
|
|
|
|
|
TargetPlatformId = platformId != -1 ? platformId : (int?)null; // Update the value for all clients
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnArrivalOnPlatform()
|
|
|
|
|
{
|
|
|
|
|
ClearTargetPlatform();
|
|
|
|
|
SetOnPlatform(true);
|
|
|
|
|
SetOnPlatform(true); // Automatically syncs to all clients
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnLeavingPlatform()
|
|
|
|
|
{
|
|
|
|
|
SetOnPlatform(false);
|
|
|
|
|
SetOnPlatform(false); // Automatically syncs to all clients
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetOnPlatform(bool status)
|
|
|
|
|
{
|
|
|
|
|
IsOnAPlatform = status;
|
|
|
|
|
if (IsServer)
|
|
|
|
|
{
|
|
|
|
|
IsOnAPlatform = status; // Update on the server
|
|
|
|
|
UpdatePlatformStatusClientRpc(status); // Notify all clients
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogWarning("SetOnPlatform should only be called on the server.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ClientRpc]
|
|
|
|
|
private void UpdatePlatformStatusClientRpc(bool status)
|
|
|
|
|
{
|
|
|
|
|
IsOnAPlatform = status; // Update the value for all clients
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|