public bool checkWallHuggerCondition(Point point, Room room, IProp prop) { var edgePoints = new List <Point>(); for (var i = 0; i < prop.Width(); i++) { for (var j = 0; j < prop.Height(); j++) { edgePoints.Add(new Point(i, j) + point + prop.Direction()); } } return(edgePoints.Intersect(room.edgePoints).Count() > 0); }
public bool checkIfPropFits(Point point, List <Point> points, IProp prop, Room room) { for (var i = 0; i < prop.Width(); i++) { for (var j = 0; j < prop.Height(); j++) { var p2 = new Point(point.X + i, point.Y + j); if (!points.Contains(p2)) { return(false); } } } // if (! prop.WallHugger()) return false; return(checkWallHuggerCondition(point, room, prop) == prop.WallHugger()); }
public void drawProp(Point point, IProp prop, List <Point> points, List <IProp> placedProps) { var offset = 1; var width = prop.Width(); var height = prop.Height(); for (var i = -offset; i < width + offset; i++) { for (var j = -offset; j < height + offset; j++) { var p2 = new Point(point.X + i, point.Y + j); points.Remove(p2); } } placedProps.Add(prop.GetPropAtPosition(point)); }
public PossiblePropPositions arrayFill(Point point, List <Point> points, IProp prop, Point direction, Room room) { var maxCount = prop.MaximumClusterCount(); var maxArea = 20; var possiblePropPositions = new List <Point>(); var propArea = prop.Width() * prop.Height(); var currentArea = 0; while (currentArea < maxArea && possiblePropPositions.Count < maxCount) { if (checkIfPropFits(point, points, prop, room)) { possiblePropPositions.Add(point); point = new Point(point.X + direction.X * prop.Width(), point.Y + direction.Y * prop.Height()); currentArea += propArea; } else { break; } } return(new PossiblePropPositions(prop, possiblePropPositions)); }