private static void RenderWallConnectorNode(Node_FloorConnector node, Direction direction, ref Scaffold scaffold) { var knownDoorsForRoots = Level.doors.Where(x => node.rootCells.Contains(x.cell_1) || node.rootCells.Contains(x.cell_2)); knownDoorsForRoots = knownDoorsForRoots.Where(x => x.ProjectDirection(node.rootCells.First()) == direction || x.ProjectDirection(node.rootCells.Last()) == direction); var knownWallsForRoots = scaffold.wall.main.Where(x => node.rootCells.Contains(x.root) && x.direction == direction); if (knownDoorsForRoots.Any() || knownWallsForRoots.Any()) { var connectorNode = new Node_WallConnector(); connectorNode.position = node.position + (direction.ToVector() * CELL_PARTIAL_OFFSET); connectorNode.root = node; connectorNode.rootCells.AddRange(node.rootCells); connectorNode.offsetRoot = node.position; connectorNode.direction = direction; scaffold.wall.connectors.Add(connectorNode); } }
//Connector Parse private static void Floor_ParseConnectors(Room room, ref Scaffold scaffold) { foreach (var cell in room.GetCells()) { var neighborsInRoom = cell.NeighborCellsInRoom(); foreach (var neighbor in neighborsInRoom) { if (!scaffold.floor.connectors.Any(x => x.position == cell.PositionBetween(neighbor))) { var node = new Node_FloorConnector(); node.position = cell.PositionBetween(neighbor); node.rootCells.Add(cell); node.rootCells.Add(neighbor); node.normal = Directionf.GetNormalTowards(node.position, node.rootCells.First().position); node.rootCells = new List <Cell>() { cell, neighbor }; scaffold.floor.connectors.Add(node); } } } }