More major updates to tools, added map area volume, made gold manager network managed per player.
This commit is contained in:
parent
b44eeaeeff
commit
56dc775c68
18 changed files with 632 additions and 283 deletions
|
|
@ -264,6 +264,23 @@ namespace TD.Gameplay
|
|||
return x >= 0 && x < level.GridSize.x && y >= 0 && y < level.GridSize.y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if <paramref name="tile"/> is part of the playable map area (inside any
|
||||
/// MapAreaVolume at bake time). Returns false for out-of-bounds tiles and for in-bounds
|
||||
/// "void" tiles outside the map area. This is the outermost gate — gameplay queries
|
||||
/// (IsWalkable, GetPlacement, GetOwner) are only meaningful where IsInMap is true.
|
||||
///
|
||||
/// Use this for: builder movement clamp, camera pan clamp, minimap rendering bounds.
|
||||
/// </summary>
|
||||
public bool IsInMap(Vector2Int tile)
|
||||
{
|
||||
if (!TryFlatIndex(tile, out int idx)) return false;
|
||||
// Defensive: existing maps that haven't been re-baked since MapAreaGrid was added
|
||||
// will have a null array. Treat that as "not in map" so callers don't false-positive.
|
||||
if (level.MapAreaGrid == null || level.MapAreaGrid.Length == 0) return false;
|
||||
return level.MapAreaGrid[idx];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True if <paramref name="tile"/> is currently walkable. Returns
|
||||
/// false for out-of-bounds tiles. Reflects the runtime walkability
|
||||
|
|
@ -451,4 +468,4 @@ namespace TD.Gameplay
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue