예제 #1
0
    /** ConnectRooms: Work in progress
     */
    public void ConnectRooms(BinaryTreeNode <RectInt> partition)
    {
        // set up list for each set of rooms
        List <BinaryTreeNode <RectInt> > roomsOfLeftChild  = new List <BinaryTreeNode <RectInt> >();
        List <BinaryTreeNode <RectInt> > roomsOfRightChild = new List <BinaryTreeNode <RectInt> >();

        CollectLeaves(partition.leftChild, roomsOfLeftChild);
        CollectLeaves(partition.rightChild, roomsOfRightChild);

        List <RectInt> partitionLeftRooms = new List <RectInt>();

        foreach (BinaryTreeNode <RectInt> leaf in roomsOfLeftChild)
        {
            partitionLeftRooms.Add(NodeRectNode(leaf, partition));
        }

        List <RectInt> partitionRightRooms = new List <RectInt>();

        foreach (BinaryTreeNode <RectInt> leaf in roomsOfRightChild)
        {
            partitionRightRooms.Add(NodeRectNode(leaf, partition));
        }

        RectInt hallRoom = GetHallRectInt(partitionLeftRooms, partitionRightRooms);

        partition.AddHallway(hallRoom);
    }