This commit is contained in:
Matt F 2026-06-23 22:36:57 -07:00
commit 04d4167db6
4 changed files with 76 additions and 25 deletions

View file

@ -76,6 +76,7 @@ namespace TD.Gameplay
// possible if pathing is dynamic).
private bool hasLeakedOriginZone;
private EnemyStatus status;
private EnemyHealth health;
private bool hasReachedGoal;
private bool wasStuck; // dedupes the "no path" warning
@ -126,6 +127,7 @@ namespace TD.Gameplay
public override void OnNetworkSpawn()
{
status = GetComponent<EnemyStatus>();
health = GetComponent<EnemyHealth>();
// Randomize the walk-cycle phase on every peer independently. Animations
// are purely visual and not replicated, so each client picks its own offset —
@ -182,6 +184,7 @@ namespace TD.Gameplay
private void Update()
{
if (!IsServer) return;
if (health != null && health.IsHeld) return;
if (remainingPath.Count == 0) return;
float effectiveSpeed = moveSpeed * (status != null ? status.GetSpeedMultiplier() : 1f);