diff --git a/Assets/Scripts/Gameplay/AbilitySystem.cs b/Assets/Scripts/Gameplay/AbilitySystem.cs index a4a244c..0022cc4 100644 --- a/Assets/Scripts/Gameplay/AbilitySystem.cs +++ b/Assets/Scripts/Gameplay/AbilitySystem.cs @@ -154,6 +154,7 @@ public class AbilitySystem : NetworkBehaviour if (Input.GetMouseButtonUp(0)) { UseActiveAbility(); + lineIndicator.positionCount = 0; lineIndicator.gameObject.SetActive(false); } } diff --git a/Assets/Scripts/Gameplay/CrowManager.cs b/Assets/Scripts/Gameplay/CrowManager.cs index 123c47e..d32241e 100644 --- a/Assets/Scripts/Gameplay/CrowManager.cs +++ b/Assets/Scripts/Gameplay/CrowManager.cs @@ -11,7 +11,8 @@ public class CrowManager : NetworkBehaviour private List players = new List(); private ServerCharacter currentCrow; - + public GameObject activeForesight; + private void Awake() { if (Instance != null && Instance != this) @@ -88,6 +89,11 @@ public class CrowManager : NetworkBehaviour if (currentCrow != null) { currentCrow.Movement.SetSpeedModifier(1f); + var foresightPrefab = FindObjectOfType(); + if (foresightPrefab) + { + foresightPrefab.DespawnForesight(); + } currentCrow.SetAsCrow(false); // Clear old crow } @@ -136,19 +142,19 @@ public class CrowManager : NetworkBehaviour } else { - // If a player was the crow but is now losing it, request foresight removal - if (player.IsCrow) - { - Debug.Log($"[CrowManager] {player.name} is no longer the Crow. Requesting foresight removal."); - if (IsServer) - { - var foresightPrefab = FindObjectOfType(); - if (foresightPrefab) - { - foresightPrefab.DespawnForesight(); - } - } - } + // // If a player was the crow but is now losing it, request foresight removal + // if (player.IsCrow) + // { + // Debug.Log($"[CrowManager] {player.name} is no longer the Crow. Requesting foresight removal."); + // if (IsServer) + // { + // var foresightPrefab = FindObjectOfType(); + // if (foresightPrefab) + // { + // foresightPrefab.DespawnForesight(); + // } + // } + // } player.SetAsCrow(false); player.SwitchToPlayerModel(); @@ -273,36 +279,7 @@ public class CrowManager : NetworkBehaviour foresightPrefab.OnSwapRequested(senderId, receiverId, senderPos, receiverPos); } - - - [Rpc(SendTo.Everyone)] - private void NotifySwapForesightAcceptedClientRpc(ulong senderId, Vector3 receiverPos) - { - Debug.Log($"[CrowManager] NotifySwapForesightAcceptedClientRpc received - Sender: {senderId}, ReceiverPos: {receiverPos}"); - - if (currentCrow == null) - { - Debug.LogError("[CrowManager] Error: Current Crow is null!"); - return; - } - - if (currentCrow.clientCharacter == null) - { - Debug.LogError("[CrowManager] Error: Current Crow clientCharacter is null!"); - return; - } - - var foresightPrefab = FindObjectOfType(); - - if (foresightPrefab == null) - { - Debug.LogError("[CrowManager] Error: CrowsForesightPrefab not found on Crow!"); - return; - } - - foresightPrefab.OnSwapAccepted(senderId, receiverPos); - } - + }