private void MergeFloor(MazeFloor Floor) { foreach (MazeNode Node in Floor.Nodes()) { if (Node.ExitCount > 0) { // If one doesn't already exist, create a new node so that we can force it to merge (for more // uniform control). Assign the new nodes up vector based on current rotation (from ZPos = Up) if (!m_NodeMap.ContainsKey(Node.Position)) { m_NodeMap.Add(Node.Position, Node); } else { m_NodeMap[Node.Position] = m_NodeMap[Node.Position].MergeNode(Node); } // Here we need to see if there's an exit down deeper into the maze. If so, generate // a mapnode manually to represent the exit out in that lower Region. This will cause // it to be merged in when loading the next Floor down if (m_NodeMap[Node.Position].ContainsExitPoint(GridPosition.DownExit)) { GridPosition TempPosition = new GridPosition(Node.Position.GridVector + GridPosition.DownExit.GridVector); if (!m_NodeMap.ContainsKey(TempPosition)) { m_NodeMap.Add(TempPosition, new MazeNode(TempPosition)); } m_NodeMap[TempPosition].AddExitPoint(GridPosition.UpExit); } } } }