AttemptToPositionRoomInsideTiles(Tiles tiles, Room room) { for (var attempts = 0; attempts < NumAttemptTillGrowMaze; ++attempts) { var start = tiles.RandomRockTile(); var(topLeft, topRight, bottomLeft, bottomRight) = room.GetCorners(); topLeft += start; topRight += start; bottomLeft += start; bottomRight += start; var isInsideMaze = tiles.IsInside(topLeft) && tiles.IsInside(topRight) && tiles.IsInside(bottomLeft) && tiles.IsInside(bottomRight); if (isInsideMaze) { return(topLeft, topRight, bottomLeft, bottomRight); } } return(Coordinate.NotSet, Coordinate.NotSet, Coordinate.NotSet, Coordinate.NotSet); }
internal static IDispatchee GetDispatchee(this Tiles tiles, Coordinate coordinates, DispatchRegistry registry) { if (!tiles.IsInside(coordinates) || tiles.IsEmptyTile(coordinates)) { return(null); } var uniqueId = tiles[coordinates]; return(registry.GetDispatchee(uniqueId)); }