Adding flying functionality for enemies
This commit is contained in:
parent
54f11d91ff
commit
d685894878
6 changed files with 83 additions and 26 deletions
|
|
@ -316,6 +316,23 @@ namespace TD.Gameplay
|
|||
return runtimeWalkability[idx];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if <paramref name="tile"/> is walkable in the BAKED terrain grid, ignoring
|
||||
/// any runtime tower placement. Returns false for out-of-bounds tiles.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Flying enemies path against this grid so they soar over towers (which only
|
||||
/// affect <see cref="IsWalkable"/>'s runtime grid) while still respecting
|
||||
/// impassable terrain and map bounds. Because the baked grid never changes at
|
||||
/// runtime, flying paths are computed once and never need invalidation.
|
||||
/// </remarks>
|
||||
public bool IsBaseWalkable(Vector2Int tile)
|
||||
{
|
||||
if (level == null || level.WalkabilityGrid == null) return false;
|
||||
if (!TryFlatIndex(tile, out int idx)) return false;
|
||||
return level.WalkabilityGrid[idx];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Placement state for <paramref name="tile"/>. Returns
|
||||
/// <see cref="PlacementState.Outside"/> for out-of-bounds tiles.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue