Merge branch 'dev-hazim' into dev-main

dev-ali
Hazim Bin Ijaz 2 days ago
commit bb66076096

@ -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

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

@ -11,8 +11,7 @@ public class CrowManager : NetworkBehaviour
private List<ServerCharacter> players = new List<ServerCharacter>();
private ServerCharacter currentCrow;
public GameObject activeForesight;
public Transform mapCenter;
private void Awake()
{
if (Instance != null && Instance != this)
@ -109,21 +108,25 @@ 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>
/// RPC to notify clients about the Crow change.
/// </summary>

@ -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()
{

@ -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 float spawnRadius = 18f; // Fixed spawn radius around the map center
public override void Execute(ServerCharacter character, Vector3 startPoint, Vector3 direction)
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);
Vector3 mapCenter = CrowManager.Instance.mapCenter.position; // Use dynamic map center
GameObject boxInstance = Instantiate(prefab, adjustedStartPoint, Quaternion.LookRotation(direction));
// 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<NetworkObject>(out var netObj))
{
netObj.Spawn();
boxInstance.GetComponent<ExecutionerBox>().Initialize(
character,
adjustedStartPoint,
adjustedEndPoint,
spawnPoint,
endPoint,
travelTime
);
}
}
}

Loading…
Cancel
Save