38 lines
935 B
C#
38 lines
935 B
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 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
|
|
}
|