Merge branch 'dev-hazim' into dev-main

dev-ali
Hazim Bin Ijaz 2 days ago
commit bb66076096

@ -20,5 +20,6 @@ MonoBehaviour:
abilityCooldownTime: 0 abilityCooldownTime: 0
abilityApplicationRadius: 20 abilityApplicationRadius: 20
prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3} prefab: {fileID: 2026889198986879358, guid: cbe217685dd069b47ac56eefeb3f6cdc, type: 3}
travelTime: 2 travelTime: 3
lineLength: 50 spawnRadius: 30
moveThroughCenterDistance: 60

@ -113,10 +113,10 @@ public class AbilitySystem : NetworkBehaviour
isWallPlacementStarted = false; isWallPlacementStarted = false;
} }
} }
else if (activeAbility.abilityKey == "TheExecutioner") // else if (activeAbility.abilityKey == "TheExecutioner")
{ // {
HandleExecutionerPlacement(); // HandleExecutionerPlacement();
} // }
else else
{ {
ManageStandardAbilityIndicator(); ManageStandardAbilityIndicator();

@ -11,8 +11,7 @@ public class CrowManager : NetworkBehaviour
private List<ServerCharacter> players = new List<ServerCharacter>(); private List<ServerCharacter> players = new List<ServerCharacter>();
private ServerCharacter currentCrow; private ServerCharacter currentCrow;
public GameObject activeForesight; public Transform mapCenter;
private void Awake() private void Awake()
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
@ -109,19 +108,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>

@ -196,6 +196,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);
@ -265,6 +273,7 @@ namespace Unity.Multiplayer.Samples.BossRoom
timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime)); timerCoroutine = StartCoroutine(UpdateTimerShader(maxTime));
} }
} }
[ClientRpc] [ClientRpc]
private void PauseClientRpc() private void PauseClientRpc()
{ {

@ -7,27 +7,34 @@ public class TheExecutionerAbility : Ability
{ {
[Header("Executioner Settings")] [Header("Executioner Settings")]
public float travelTime = 2f; public float travelTime = 2f;
public float lineLength = 50f; public float spawnRadius = 18f; // Fixed spawn radius around the map center
public float boxStartingPointOffset = 20f;
public float boxEndingPointOffset = 20f; public override void Execute(ServerCharacter character, Vector3 ignoredStartPoint, Vector3 ignoredDirection)
public override void Execute(ServerCharacter character, Vector3 startPoint, Vector3 direction)
{ {
// Extend start and end points Vector3 mapCenter = CrowManager.Instance.mapCenter.position; // Use dynamic map center
Vector3 adjustedStartPoint = startPoint - (direction * boxStartingPointOffset);
Vector3 adjustedEndPoint = startPoint + (direction * lineLength) + (direction * boxEndingPointOffset); // Generate a random point on the edge of the circle (radius = spawnRadius)
float angle = Random.Range(0f, Mathf.PI * 2);
GameObject boxInstance = Instantiate(prefab, adjustedStartPoint, Quaternion.LookRotation(direction)); 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<NetworkObject>(out var netObj)) if (boxInstance.TryGetComponent<NetworkObject>(out var netObj))
{ {
netObj.Spawn(); netObj.Spawn();
boxInstance.GetComponent<ExecutionerBox>().Initialize( boxInstance.GetComponent<ExecutionerBox>().Initialize(
character, character,
adjustedStartPoint, spawnPoint,
adjustedEndPoint, endPoint,
travelTime travelTime
); );
} }
} }
} }

Loading…
Cancel
Save