public override void Paint(Level level) { var painter = new RoomPainter(level, this); PaintOutsideWalls(level); var newRect = new RogueRect(Bounds); newRect.Left += 1; newRect.Right = newRect.Left + 2; newRect.Top -= 2; newRect.Bottom += 1; painter.PaintFloorArea(newRect); newRect.Right = Bounds.Right - 2; newRect.Left = newRect.Right - 2; painter.PaintFloorArea(newRect); newRect = new RogueRect(Bounds); newRect.Bottom += 1; newRect.Top = newRect.Bottom + 2; newRect.Left += 1; newRect.Right -= 2; painter.PaintFloorArea(newRect); newRect.Top = Bounds.Top - 2; newRect.Bottom = newRect.Top - 2; painter.PaintFloorArea(newRect); painter.AutoPaintWalls(); }
public override void Paint(Level level) { var painter = new RoomPainter(level, this); var center = GetCenterPoint(); //Helpers.DrawDebugLine(center.x, center.y); foreach (var door in ConnectionPoints.Values) { var start = new Vector2Int(door.x, door.y); if (start.y == Bounds.Top) { start.y--; } else if (start.x == Bounds.Right) { start.x--; } int rightShift = (int)center.x - start.x; int downShift = (int)center.y - start.y; Vector2Int mid; Vector2Int end; //always goes inward first if (door.x == Bounds.Left || door.x == Bounds.Right) { mid = new Vector2Int(start.x + rightShift, start.y); end = new Vector2Int(mid.x, mid.y + downShift); } else { mid = new Vector2Int(start.x, start.y + downShift); end = new Vector2Int(mid.x + rightShift, mid.y); } var firstHalf = new RogueRect(start, mid); var secondHalf = new RogueRect(mid, end); painter.PaintFloorArea(firstHalf); painter.PaintFloorArea(secondHalf); } painter.AutoPaintWalls(); }