diff --git a/Assets/GameData/Action/Abilities/The Executioner Ability.asset b/Assets/GameData/Action/Abilities/The Executioner Ability.asset index 4bc3448..4e425c0 100644 --- a/Assets/GameData/Action/Abilities/The Executioner Ability.asset +++ b/Assets/GameData/Action/Abilities/The Executioner Ability.asset @@ -20,5 +20,6 @@ MonoBehaviour: abilityCooldownTime: 0 abilityApplicationRadius: 20 prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3} - travelTime: 2 - lineLength: 50 + travelTime: 3 + spawnRadius: 30 + moveThroughCenterDistance: 60 diff --git a/Assets/Scripts/Gameplay/AbilitySystem.cs b/Assets/Scripts/Gameplay/AbilitySystem.cs index 52e4362..28b8ea9 100644 --- a/Assets/Scripts/Gameplay/AbilitySystem.cs +++ b/Assets/Scripts/Gameplay/AbilitySystem.cs @@ -113,10 +113,10 @@ public class AbilitySystem : NetworkBehaviour isWallPlacementStarted = false; } } - else if (activeAbility.abilityKey == "TheExecutioner") - { - HandleExecutionerPlacement(); - } + // else if (activeAbility.abilityKey == "TheExecutioner") + // { + // HandleExecutionerPlacement(); + // } else { ManageStandardAbilityIndicator(); diff --git a/Assets/Scripts/Gameplay/CrowManager.cs b/Assets/Scripts/Gameplay/CrowManager.cs index 582358e..36ed9f5 100644 --- a/Assets/Scripts/Gameplay/CrowManager.cs +++ b/Assets/Scripts/Gameplay/CrowManager.cs @@ -11,8 +11,7 @@ public class CrowManager : NetworkBehaviour private List players = new List(); private ServerCharacter currentCrow; - public GameObject activeForesight; - + public Transform mapCenter; private void Awake() { if (Instance != null && Instance != this) @@ -109,19 +108,23 @@ public class CrowManager : NetworkBehaviour /// /// Clears the current Crow if no player is unoccupied. /// - 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(); } + /// diff --git a/Assets/Scripts/Gameplay/Platform.cs b/Assets/Scripts/Gameplay/Platform.cs index a4908ee..ed7b0b8 100644 --- a/Assets/Scripts/Gameplay/Platform.cs +++ b/Assets/Scripts/Gameplay/Platform.cs @@ -196,6 +196,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); @@ -265,6 +273,7 @@ namespace Unity.Multiplayer.Samples.BossRoom timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime)); } } + [ClientRpc] private void PauseClientRpc() { diff --git a/Assets/Scripts/Gameplay/TheExecutionerAbility.cs b/Assets/Scripts/Gameplay/TheExecutionerAbility.cs index 82e5d46..48f7232 100644 --- a/Assets/Scripts/Gameplay/TheExecutionerAbility.cs +++ b/Assets/Scripts/Gameplay/TheExecutionerAbility.cs @@ -7,27 +7,34 @@ public class TheExecutionerAbility : Ability { [Header("Executioner Settings")] public float travelTime = 2f; - public float lineLength = 50f; - public float boxStartingPointOffset = 20f; - public float boxEndingPointOffset = 20f; - - public override void Execute(ServerCharacter character, Vector3 startPoint, Vector3 direction) + public float spawnRadius = 18f; // Fixed spawn radius around the map center + + public override void Execute(ServerCharacter character, Vector3 ignoredStartPoint, Vector3 ignoredDirection) { - // Extend start and end points - Vector3 adjustedStartPoint = startPoint - (direction * boxStartingPointOffset); - Vector3 adjustedEndPoint = startPoint + (direction * lineLength) + (direction * boxEndingPointOffset); - - GameObject boxInstance = Instantiate(prefab, adjustedStartPoint, Quaternion.LookRotation(direction)); + Vector3 mapCenter = CrowManager.Instance.mapCenter.position; // Use dynamic map center + + // Generate a random point on the edge of the circle (radius = spawnRadius) + float angle = Random.Range(0f, Mathf.PI * 2); + Vector3 spawnPoint = new Vector3( + mapCenter.x + Mathf.Cos(angle) * spawnRadius, + mapCenter.y, + mapCenter.z + Mathf.Sin(angle) * spawnRadius + ); + + // Calculate the exact opposite point across the center (radius * 2 away) + Vector3 endPoint = mapCenter + (mapCenter - spawnPoint); + + // Spawn and initialize the executioner box + GameObject boxInstance = Instantiate(prefab, spawnPoint, Quaternion.LookRotation(endPoint - spawnPoint)); if (boxInstance.TryGetComponent(out var netObj)) { netObj.Spawn(); boxInstance.GetComponent().Initialize( character, - adjustedStartPoint, - adjustedEndPoint, + spawnPoint, + endPoint, travelTime ); } } - }