We've got enemies and movement!!
This commit is contained in:
parent
42ee0bf65d
commit
3287e8ea43
26 changed files with 1409 additions and 161 deletions
|
|
@ -365,6 +365,14 @@ namespace TD.Gameplay
|
|||
// NetworkObject spawns and its Start/OnNetworkSpawn stamps its own
|
||||
// footprint locally.
|
||||
|
||||
/// <summary>
|
||||
/// Fired on every peer whenever <see cref="SetWalkable"/> changes a tile's
|
||||
/// walkability. <see cref="TD.Gameplay.PathfindingService"/> subscribes to
|
||||
/// invalidate cached paths so in-flight enemies reroute after a tower is
|
||||
/// placed or removed.
|
||||
/// </summary>
|
||||
public event System.Action OnWalkabilityChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the runtime walkability of <paramref name="tile"/>. Called by
|
||||
/// <c>TowerPlacementManager</c> on the server when a tower is accepted (pass
|
||||
|
|
@ -374,7 +382,9 @@ namespace TD.Gameplay
|
|||
public void SetWalkable(Vector2Int tile, bool walkable)
|
||||
{
|
||||
if (!TryFlatIndex(tile, out int idx)) return;
|
||||
if (runtimeWalkability[idx] == walkable) return; // no change — don't fire event
|
||||
runtimeWalkability[idx] = walkable;
|
||||
OnWalkabilityChanged?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue