Example #1
0
        public void BuildMap()
        {
            if (m_MapViewer == null)
            {
                m_MapViewer = GetComponent <MapViewer>();
                if (m_MapViewer == null)
                {
                    m_MapViewer = gameObject.AddComponent <MapViewer_Full>();
                }
                m_ArchiveFile = new MapArchiveFile(config);
                m_MapViewer.InitMapViewer(m_ArchiveFile, map_root);
            }

            ClearMap();
            map_data = GenerateTileMapData();

            for (int y = 0; y < config.tile_size_x; y++)
            {
                for (int x = 0; x < config.tile_size_y; x++)
                {
                    int index            = SharedUtil.PointHash(x, y);
                    TilePrefabConfig tpc = config.GetTilePrefabConfig(map_data[index]);
                    if (tpc != null)
                    {
                        m_MapViewer.SpawnTileMapAt(x, y, config.grid_size, map_root, tpc);
                    }
                }
            }
        }
Example #2
0
        //BuildMap一般只在Editor中运行
        public void BuildMap()
        {
            ClearMap();
            config.theme_config.RebuildTileThemeConfig();
            m_ArchiveFile = new MapArchiveFile(config);
            m_ArchiveFile.GeneratePerinMaze();

            m_MapViewer = GetComponent <MapViewer>();
            m_MapViewer.InitMapViewer(m_ArchiveFile, m_MapRoot);
        }