public RoomGenerateInfo RandomFightRoom()
        {
            List <Type>      pools = null;
            RoomGenerateInfo info  = new RoomGenerateInfo();

            info.ty       = null;
            info.roomType = RoomType.Normal;

            if (generateConfig.normalRoomCount > curGenerateInfo.normalRoomCount)
            {
                pools = generateConfig.normalPools;
            }

            if (pools != null)
            {
                int rnd = Random(0, pools.Count);
                info.ty = pools[rnd];
            }

            return(info);
        }
        int GenerateAt(int x, int y, int depth)
        {
            if (!IsValidIndex(x, y))
            {
                return(0);
            }

            if (usedGrid >= maxUseGrid)
            {
                return(0);
            }

            //if too deep
            if (depth > generateConfig.randomCutAtDeep && Random(1, depth) < generateConfig.cutParam)
            {
                return(1);
            }

            Grid grid = grids[x, y];

            if (grid.steped)
            {
                return(0);
            }
            grid.steped = true;

            if (grid.owner == null)
            {
                RoomGenerateInfo info = RandomFightRoom();
                if (info.ty != null)
                {
                    RoomNode room = (RoomNode)Activator.CreateInstance(info.ty);
                    room.roomType = info.roomType;
                    if (room.Place(x, y, this))
                    {
                        ++curGenerateInfo.normalRoomCount;
                        usedGrid += room.gridList.Count;
                        roomList.Add(room);
                        room.SetPosition(room.gridList[0].position);
                        room.RepositionDoors();
                        room.CalculateTransportPos();
                    }
                }
            }

            //4 direction
            var dirOffset = GenDirList();

            if (1 == GenerateAt(x + dirOffset[0].x, y + dirOffset[0].y, depth + 1))
            {
                return(1);
            }
            if (1 == GenerateAt(x + dirOffset[1].x, y + dirOffset[1].y, depth + 1))
            {
                return(1);
            }
            if (1 == GenerateAt(x + dirOffset[2].x, y + dirOffset[2].y, depth + 1))
            {
                return(1);
            }
            if (1 == GenerateAt(x + dirOffset[3].x, y + dirOffset[3].y, depth + 1))
            {
                return(1);
            }

            return(0);
        }