Dungeon improvements
This commit is contained in:
@@ -13,7 +13,12 @@ public class DungeonLayout
|
||||
public int Height { get; set; }
|
||||
public int TileSize { get; set; }
|
||||
|
||||
/// <summary>Tile IDs (for V2) or 0/1 (for V1)</summary>
|
||||
public int[,] Tiles { get; set; } = new int[0, 0];
|
||||
|
||||
/// <summary>Walkability grid (true = can walk, false = blocked)</summary>
|
||||
public bool[,]? Walkable { get; set; }
|
||||
|
||||
public List<DungeonRoom> Rooms { get; set; } = new();
|
||||
public DungeonPoint SpawnPoint { get; set; }
|
||||
public DungeonPoint? ExitPosition { get; set; } // Set when dungeon is cleared
|
||||
@@ -24,6 +29,20 @@ public class DungeonLayout
|
||||
public int TotalMobs { get; set; }
|
||||
public int TotalChests { get; set; }
|
||||
|
||||
/// <summary>Check if a tile position is walkable</summary>
|
||||
public bool IsWalkable(int x, int y)
|
||||
{
|
||||
if (x < 0 || x >= Width || y < 0 || y >= Height)
|
||||
return false;
|
||||
|
||||
// If we have explicit walkability array, use it
|
||||
if (Walkable != null)
|
||||
return Walkable[x, y];
|
||||
|
||||
// Fallback: V1 convention (0 = wall, non-zero = floor)
|
||||
return Tiles[x, y] != 0;
|
||||
}
|
||||
|
||||
// Serialize tiles to string for DB storage
|
||||
public string SerializeTiles()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user