using UnityEngine;
using System.Collections.Generic;
///
/// Represents a room in the maze
///
public class MazeRoom
{
///
/// Types of rooms with different purposes
///
public enum RoomType
{
Normal, // Regular room
Safe, // Safe room (no monsters)
Rest, // Resting area (healing)
Restroom, // Restroom (special purpose)
Boss, // Boss room
End, // Exit/End room
}
public int Id { get; set; }
public RoomType Type { get; set; }
public int MinX { get; set; }
public int MinY { get; set; }
public int MaxX { get; set; }
public int MaxY { get; set; }
public int Width => MaxX - MinX + 1;
public int Height => MaxY - MinY + 1;
public List Exits { get; set; } = new(); // Connection points to other rooms/hallways
public bool IsStart { get; set; }
public bool IsEnd { get; set; }
public MazeRoom(int id, int minX, int minY, int maxX, int maxY, RoomType type = RoomType.Normal)
{
Id = id;
MinX = minX;
MinY = minY;
MaxX = maxX;
MaxY = maxY;
Type = type;
}
///
/// Checks if a point is inside this room
///
public bool Contains(int x, int y)
{
return x >= MinX && x <= MaxX && y >= MinY && y <= MaxY;
}
///
/// Gets the center of the room
///
public Vector2Int GetCenter()
{
return new Vector2Int((MinX + MaxX) / 2, (MinY + MaxY) / 2);
}
///
/// Gets a random point inside this room
///
public Vector2Int GetRandomPoint()
{
int x = Random.Range(MinX + 1, MaxX);
int y = Random.Range(MinY + 1, MaxY);
return new Vector2Int(x, y);
}
}