public void BlockDoor(Vector2 dir, int size)
    {
        Vector2    pos      = room.GetPosition();
        GameObject newBlock = Instantiate(block);

        doorBlocks.Add(newBlock);
        int offset = size / 2;

        newBlock.transform.position = pos + dir * offset;
        Vector2 perp = new Vector2(dir.y, -dir.x);

        GameObject block2 = Instantiate(block);

        doorBlocks.Add(block2);
        GameObject block3 = Instantiate(block);

        doorBlocks.Add(block3);
        block2.transform.position = pos + dir * offset + perp;
        block3.transform.position = pos + dir * offset - perp;
    }
    public List <Vector2> GetPathThroughDungeon()
    {
        List <Vector2> path    = new List <Vector2> ();
        AP_Room        curRoom = DungeonRooms [0];


        int curRoomIndex = 0;

        do
        {
            curRoom = DungeonRooms [curRoomIndex];

            if (curRoom.GetRoomType() == AP_Room.RoomType.mid)
            {
                Vector2 closeEntry = curRoom.GetPosition();
                Vector2 farExit    = curRoom.GetPosition();
                for (int i = 1; i < 4; i++)                     // increment through the 4 rooms of the mid room to get the room closest and furthest from last room. These will be the entry/exit rooms
                {
                    Vector2 previousRoomPos = DungeonRooms[curRoomIndex - 1].GetPosition();

                    float distance = Vector2.Distance(previousRoomPos, DungeonRooms[curRoomIndex + i].GetPosition());
                    if (distance < Vector2.Distance(previousRoomPos, closeEntry))
                    {
                        closeEntry = DungeonRooms[curRoomIndex + i].GetPosition();
                    }
                    else if (distance > Vector2.Distance(previousRoomPos, farExit))
                    {
                        farExit = DungeonRooms[curRoomIndex + i].GetPosition();
                    }
                }
                path.Add(closeEntry);
                path.Add(farExit);
                curRoomIndex += 4;
            }
            else if (curRoom.GetRoomType() == AP_Room.RoomType.end)
            {
                Vector2 closeEntry = curRoom.GetPosition();
                Vector2 centroid   = closeEntry;
                for (int i = 1; i < 4; i++)
                {
                    centroid += DungeonRooms[curRoomIndex + i].GetPosition();
                    Vector2 previousRoomPos = DungeonRooms[curRoomIndex - 1].GetPosition();
                    float   distance        = Vector2.Distance(previousRoomPos, DungeonRooms[curRoomIndex + i].GetPosition());
                    if (distance < Vector2.Distance(previousRoomPos, closeEntry))
                    {
                        closeEntry = DungeonRooms[curRoomIndex + i].GetPosition();
                    }
                }
                centroid /= 4;
                path.Add(closeEntry);
                path.Add(centroid);
            }
            else             // cur room must be a main path room
            {
                Vector2 roomPos = curRoom.GetPosition();
                path.Add(roomPos);
                curRoomIndex++;
            }
        } while (curRoom.GetRoomType() != AP_Room.RoomType.end);

        return(path);
    }