Example #1
0
        public TileType[,] Generate(FloorOptions _opts)
        {
            // TODO: Merge default opts with opts;
            opts = _opts;

            //Random.seed = (int)opts["seed"];

            n_i        = (int)(opts.numRows / 2);
            n_j        = (int)(opts.numCols / 2);
            n_rows     = n_i * 2;
            n_cols     = n_j * 2;
            max_row    = n_rows - 1;
            max_col    = n_cols - 1;
            n_rooms    = 0;
            room_min   = opts.roomSizeMin;
            room_max   = opts.roomSizeMax;
            room_base  = (int)((room_min + 1) / 2);
            room_radix = (int)((room_max - room_min) / 2) + 1;

            rooms         = new List <Room>();
            roomIdForTile = new int[n_rows + 1, n_cols + 1];
            tiles         = new TileType[n_rows + 1, n_cols + 1];

            InitTiles();
            PackRooms();
            OpenRooms();
            CreateCorridors();
            RemoveDeadends();
            FixDoors();
            EmptyBlocks();

            return(tiles);
        }
Example #2
0
        public static Floor Create(FloorOptions _opts)
        {
            var floor = new Floor();

            floor.Generate(_opts);
            return(floor);
        }