enemies spawn held in place
This commit is contained in:
parent
54f11d91ff
commit
ff921080db
4 changed files with 75 additions and 26 deletions
|
|
@ -71,6 +71,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
|
||||
|
||||
|
|
@ -119,6 +120,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 —
|
||||
|
|
@ -172,6 +174,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue