Everything related to chat functionality, and updating the projectile prefab to rotate properly
This commit is contained in:
parent
d92d00c83f
commit
66f84652dc
14 changed files with 1133 additions and 121 deletions
|
|
@ -61,6 +61,7 @@ namespace TD.Gameplay
|
|||
private PlayerSlot currentZone = PlayerSlot.None;
|
||||
private EnemyStatus status;
|
||||
private bool hasReachedGoal;
|
||||
private bool wasStuck; // dedupes the "no path" warning
|
||||
|
||||
// ----- Events ---------------------------------------------------------
|
||||
|
||||
|
|
@ -164,6 +165,12 @@ namespace TD.Gameplay
|
|||
if (toTarget.sqrMagnitude > 0.0001f)
|
||||
transform.rotation = Quaternion.LookRotation(toTarget);
|
||||
}
|
||||
|
||||
// Per-frame zone tracking. With path smoothing, waypoints can be
|
||||
// multiple tiles apart and a straight-line segment may cross zone
|
||||
// boundaries. Checking the current tile every frame ensures
|
||||
// OnZoneLeaked fires the moment the enemy enters a new zone.
|
||||
CheckZoneTransition(GridCoordinates.WorldToGrid(transform.position));
|
||||
}
|
||||
|
||||
// ----- Path management ------------------------------------------------
|
||||
|
|
@ -231,9 +238,25 @@ namespace TD.Gameplay
|
|||
|
||||
remainingPath = service.ComputePath(fromTile);
|
||||
|
||||
// Dedupe the "no path" log: only emit on the transition into stuck
|
||||
// state, not every frame a walkability change re-fires the recompute.
|
||||
// Stuck enemies are a legitimate edge case (tower placement disconnected
|
||||
// a pocket the enemy was in — placement BFS only checks spawner→exit
|
||||
// reachability, not every enemy's current tile). The enemy will just
|
||||
// stand still until a placement change re-opens a route.
|
||||
if (remainingPath.Count == 0)
|
||||
Debug.LogWarning($"[EnemyMovement] No path found from {fromTile}. " +
|
||||
"TowerPlacementManager should have prevented a full block.");
|
||||
{
|
||||
if (!wasStuck)
|
||||
{
|
||||
Debug.Log($"[EnemyMovement] No path from {fromTile} — enemy is " +
|
||||
"stuck in a disconnected pocket. Will retry on next walkability change.");
|
||||
wasStuck = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wasStuck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue