Пример #1
0
        private void AddTilePrefabConfig(TilePrefabConfig config)
        {
            if (config == null)
            {
                return;
            }

            List <TilePrefabConfig> theme_item = null;

            if (prefab_index.TryGetValue(config.theme_name, out theme_item) == false)
            {
                theme_item = new List <TilePrefabConfig>();
                prefab_index[config.theme_name] = theme_item;
            }

            theme_item.Add(config);
        }
Пример #2
0
        public void BuildMap()
        {
            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)
                    {
                        tpc.CreateInstance(x, y, config.grid_size, map_root);
                    }
                }
            }
        }