Fixed rooms being created where they would collide with an unavailable point on the map.
This commit is contained in:
parent
d091a7f745
commit
5f2be1333b
3 changed files with 36 additions and 31 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue