Fixed the crow issue where

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

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

@ -190,6 +190,14 @@ namespace Unity.Multiplayer.Samples.BossRoom
{ {
return; 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; IsOccupied = true;
occupierId.Value = player.OwnerClientId; occupierId.Value = player.OwnerClientId;
player.OnArrivalOnPlatform(PlatformID.Value); player.OnArrivalOnPlatform(PlatformID.Value);
@ -253,6 +261,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime)); timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime));
} }
} }
[ClientRpc] [ClientRpc]
private void PauseClientRpc() private void PauseClientRpc()
{ {

Loading…
Cancel
Save