Fixed some issues

dev-main-mobile
Hazim Bin Ijaz 1 month ago
parent 477bd9cec5
commit 50ccadf4cf

@ -22,7 +22,7 @@ public class CrowsForesightAbility : Ability
{
netObj.Spawn();
CrowsForesightPrefab foresightPrefab = foresightInstance.GetComponent<CrowsForesightPrefab>();
foresightPrefab.Initialize(CrowManager.Instance.GetCurrentCrow().OwnerClientId);
foresightPrefab.Initialize(CrowManager.Instance.GetCurrentCrow().OwnerClientId, this);
Debug.Log($"[CrowsForesightAbility] Assigned foresight prefab to Crow {character.OwnerClientId}");
}
}

@ -8,21 +8,16 @@ public class CrowsForesightPrefab : NetworkBehaviour
{
private Dictionary<ulong, LineRenderer> foresightLines = new Dictionary<ulong, LineRenderer>();
private ulong crowClientId;
private Coroutine destroyCoroutine;
private void Start()
public void Initialize(ulong crowId, CrowsForesightAbility ability)
{
crowClientId = crowId;
if (IsServer)
{
Debug.Log("[CrowsForesightPrefab] Starting auto-destroy coroutine.");
destroyCoroutine = StartCoroutine(DelayedDestroy());
StartCoroutine(DelayedDestroy(ability.abilityDuration));
}
}
public void Initialize(ulong crowId)
{
crowClientId = crowId;
}
public override void OnNetworkSpawn()
{
Debug.Log($"[CrowsForesightPrefab] OnNetworkSpawn called - LocalClientId: {NetworkManager.Singleton.LocalClientId}, crowClientId: {crowClientId}");

@ -8,21 +8,26 @@ 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)
{
Vector3 endPoint = startPoint + (direction * lineLength);
GameObject boxInstance = Instantiate(prefab, startPoint, Quaternion.LookRotation(direction));
// 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));
if (boxInstance.TryGetComponent<NetworkObject>(out var netObj))
{
netObj.Spawn();
boxInstance.GetComponent<ExecutionerBox>().Initialize(
character,
startPoint,
endPoint,
adjustedStartPoint,
adjustedEndPoint,
travelTime
);
}
}
}

Loading…
Cancel
Save