예제 #1
0
        static public void MakeMap(out AreaMap new_map, ref AreaMapTemplate template, Sizes size)
        {
            int   prev_dc_count = 0;
            Point m_size_range  = Point.Zero;

            m_size_range = Globals.GetSizeRange(MakeTarget.MAP, size);

            // get map size
            template.mapWidthTile  = rand.Next(m_size_range.X, m_size_range.Y);
            template.mapHeightTile = template.mapWidthTile;

            // load possible TileSets from template to TileSetManager
            for (int set = 0; set < template.tsNameIndices.Count(); set++)
            {
                if (!TileSetManager.CheckIfTileSetLoaded(TileSetManager.TileSetsNames[(int)template.tsNameIndices[set]]))
                {
                    TileSetManager.LoadTileSet(template.tsNameIndices[set], set);
                }
            }

            // load template into new AreaMap
            new_map = new AreaMap(ref template);

            if (new_map.areaMapType == MapTypes.ROOMS)
            {
                List <List <Point> > hall_path = new List <List <Point> >();

                RoomMaker.MakeRooms(ref new_map, ref template);
                HallMaker.ConnectRooms(ref new_map, ref hall_path, 1);
                HallMaker.MakeHalls(ref new_map, ref hall_path);

                while (!HallMaker.FloodIsConnectedCheck(ref new_map, false))
                {
                    if (prev_dc_count > 0)
                    {
                        if (prev_dc_count <= disconnectedRooms.Count())
                        {
                            break;
                        }
                    }

                    hall_path.Clear();
                    HallMaker.ConnectDCRooms(ref new_map, ref hall_path, 1);
                    HallMaker.MakeHalls(ref new_map, ref hall_path);

                    prev_dc_count = disconnectedRooms.Count();
                }
            }
            else if (new_map.areaMapType == MapTypes.OPEN)
            {
            }
            else if (new_map.areaMapType == MapTypes.ENCLOSED_ROOMS)
            {
            }

            SetStartPoint(ref new_map);
        }
예제 #2
0
        static public void Initialize(ref ContentManager cm, ref int disc_rooms, ref int room_count)
        {
            isInitialized = true;
            TileSetManager.Initialize();
            TextureManager.Initialize(cm);
            RoomMaker.initialize();
            HallMaker.initialize();
            PathFinder.Initialize();

            LoadMapSetNames();
            MapGenHelper.Initialize();

            GenerateMap(ref cm, ref disc_rooms, ref room_count);
        }