private void Start() { Source = GetComponent <InputMap>(); if (Source == null) { throw new NullReferenceException("Input map is null. Have you added a Input map component to PreProcess game object?"); } ApplicationDataPath = Application.dataPath; try { switch ((int)Mode) { case (int)MODE.HEIGHT: PreprocessDem(); break; case (int)MODE.COLOR: PreprocessOrtho(); break; default: Logger.LogWarning("PreProcessTerrain.Start: Nothing to produce/precompute!"); break; } } finally { if (DeleteTempOnFinish) { var directory = new DirectoryInfo(ApplicationDataPath + TempFolder); if (directory.Exists) { foreach (var file in directory.GetFiles()) { file.Delete(); } } } #if UNITY_EDITOR AssetDatabase.Refresh(); #endif } }
void PreprocessOrtho() { switch ((int)Type) { case (int)TYPE.PLANE: PreprocessPlaneOrtho(Source, ApplicationDataPath + TempFolder, ApplicationDataPath + DestinationFolder); break; case (int)TYPE.SPHERICAL: throw new NotImplementedException(); default: Logger.LogWarning("PreProcessTerrain.Preprocess: Nothing to produce/precompute!"); break; } }
void PreprocessDem() { switch ((int)Type) { case (int)TYPE.PLANE: PreprocessPlaneDem(Source, ApplicationDataPath + TempFolder, ApplicationDataPath + DestinationFolder); break; case (int)TYPE.SPHERICAL: PreprocessSphericalDem(Source, ApplicationDataPath + TempFolder, ApplicationDataPath + DestinationFolder); break; default: Logger.LogWarning("PreProcessTerrain.Preprocess: Nothing to produce/precompute!"); break; } }