private static void ImportTerrain()
        {
            foreach (var gameObj in GameObject.FindObjectsOfType <GameObject>())
            {
                GameObject.DestroyImmediate(gameObj);
            }

            List <MftData> additionalsMfts = new List <MftData>();

            MftData terrainMft = LoadMft("ds100"); // Terrain
            MftData vtMft      = LoadMft("ds200"); // VT

            TryAddMft(additionalsMfts, "ds101");   // Buildings
            TryAddMft(additionalsMfts, "ds102");   // Trees
            TryAddMft(additionalsMfts, "ds103");   // Bushes
            TryAddMft(additionalsMfts, "ds104");   // Walls
            TryAddMft(additionalsMfts, "ds107");   // Scene Adds

            var terrainImporter = new Importers.TerrainImporter(
                terrainMft,
                vtMft,
                additionalsMfts.ToArray()
                );

            terrainImporter.ParentTransform    = new GameObject("terrain").transform;
            terrainImporter.MaterialToUse      = AssetDatabase.LoadAssetAtPath <Material>("Packages/com.duckbearlab.mftdabaseimporter/Editor/MftDatabaseImporter/TerrainMaterial.mat");
            terrainImporter.LoadedTerrainPart += HandleLoadedTerrainPart;
            terrainImporter.LoadedTerrain     += HandleLoadedTerrain;
            terrainImporter.PrepareForLoad();
            terrainImporter.LoadAll();
        }
예제 #2
0
 void Start()
 {
     terrainImporter = new Importers.TerrainImporter(
         MftData.FromFile(TerrainMftFile),
         MftData.FromFile(VtMftFile),
         new MftData[] {
         MftData.FromFile(BuildingsMftFile),
         MftData.FromFile(TreesMftFile)
     }
         );
     terrainImporter.MaterialToUse = MaterialToUse;
     terrainImporter.PrepareForLoad();
     terrainImporter.LoadedTerrain     += terrainImporter_LoadedTerrain;
     terrainImporter.LoadedTerrainPart += terrainImporter_LoadedTerrainPart;
 }