Fixed the crow issue where

dev-hazim
Hazim Bin Ijaz 2 days ago
parent f4f1a0d92a
commit 1adc69542b

@ -109,19 +109,23 @@ public class CrowManager : NetworkBehaviour
/// <summary>
/// Clears the current Crow if no player is unoccupied.
/// </summary>
private void ClearCrow()
public void ClearCrow()
{
if (currentCrow != null)
{
Debug.Log($"[CrowManager] {currentCrow.name} landed on a platform. Removing crow status.");
currentCrow.SetAsCrow(false);
Debug.Log($"{currentCrow.name} is no longer the Crow.");
currentCrow = null;
// Notify all clients about the crow being cleared
NotifyCrowChangeClientRpc(0); // 0 indicates no crow
// Notify all clients that the crow role is cleared
NotifyCrowChangeClientRpc(0); // 0 means no crow
}
// Recalculate crow status after removing the old crow
DetermineCrow();
}
/// <summary>

@ -190,6 +190,14 @@ namespace Unity.Multiplayer.Samples.BossRoom
{
return;
}
// If the player is currently the crow, convert them back into a normal player
if (player.IsCrow)
{
Debug.Log($"[Platform] Crow {player.name} landed on platform {PlatformID.Value}, converting back to player.");
CrowManager.Instance.ClearCrow(); // Notify CrowManager to clear the current crow
}
IsOccupied = true;
occupierId.Value = player.OwnerClientId;
player.OnArrivalOnPlatform(PlatformID.Value);
@ -253,6 +261,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime));
}
}
[ClientRpc]
private void PauseClientRpc()
{

Loading…
Cancel
Save