Fixed rooms being created where they would collide with an unavailable point on the map.

This commit is contained in:
Max 2025-02-05 15:49:10 +01:00
parent d091a7f745
commit 5f2be1333b
3 changed files with 36 additions and 31 deletions

View file

@ -37,5 +37,17 @@ namespace DungeonGenerator
return points;
}
public int GetDistanceToRoom(Room other)
{
Point centerOfRoom = GetCenterOfRoom();
Point centerOfOther = other.GetCenterOfRoom();
return centerOfRoom.ManhattanDistance(centerOfOther);
}
public Point GetCenterOfRoom()
{
return new Point(PositionOfTopLeft.X + Width / 2, PositionOfTopLeft.Y + Height / 2);
}
}
}