using UnityEngine; /// /// Represents a single 1x1 unit square in the maze /// public class MazeTile { /// /// Types of tiles in the maze /// public enum TileType { Wall, // Impassable Floor, // Basic walkable floor Terrain, // Special terrain with movement penalties } /// /// Different terrain types with various properties /// public enum TerrainType { None = 0, // Not terrain Normal = 1, // Normal walkable floor (movementCost = 1.0f) Swamp = 2, // Slow terrain (movementCost = 2.0f) Lava = 3, // Dangerous terrain (movementCost = 3.0f, may cause damage) Ice = 4, // Slippery terrain (movementCost = 0.5f, but risky) Stone = 5, // Hard stone (movementCost = 1.5f) } public TileType Type { get; set; } public TerrainType Terrain { get; set; } public int RoomId { get; set; } // Which room does this tile belong to (-1 = hallway/corridor) public int X { get; private set; } public int Y { get; private set; } public MazeTile(int x, int y) { X = x; Y = y; Type = TileType.Wall; Terrain = TerrainType.None; RoomId = -1; } /// /// Gets the movement cost for this tile based on its terrain /// public float GetMovementCost() { return Terrain switch { TerrainType.Normal => 1.0f, TerrainType.Swamp => 2.0f, TerrainType.Lava => 3.0f, TerrainType.Ice => 0.5f, TerrainType.Stone => 1.5f, _ => 1.0f, }; } /// /// Checks if a character can walk on this tile /// public bool IsWalkable() { return Type == TileType.Floor || Type == TileType.Terrain; } }