Files
2026-02-11 10:06:58 -05:00

44 lines
1.2 KiB
C#

namespace GameServer.Dungeon;
public class DungeonRoom
{
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public DungeonRoomType Type { get; set; } = DungeonRoomType.Combat;
public int? TemplateId { get; set; }
public string? TemplateName { get; set; }
public int? PlayerSpawnX { get; set; }
public int? PlayerSpawnY { get; set; }
public int? ExitX { get; set; }
public int? ExitY { get; set; }
public int CenterX => X + Width / 2;
public int CenterY => Y + Height / 2;
public DungeonRoom() { }
public DungeonRoom(int x, int y, int width, int height)
{
X = x; Y = y; Width = width; Height = height;
}
public bool Intersects(DungeonRoom other, int padding = 0)
{
return X - padding < other.X + other.Width + padding &&
X + Width + padding > other.X - padding &&
Y - padding < other.Y + other.Height + padding &&
Y + Height + padding > other.Y - padding;
}
}
public enum DungeonRoomType
{
Entrance,
Combat,
Treasure,
Boss,
Empty
}