예제 #1
0
 void OnWizardUpdate()
 {
     helpString         = "Creates a minimap image of the currently loaded scene";
     fileSystemGameName = WizardUtilities.GetFileSystemGameName(gameName);
     errorString        = Validate();
     isValid            = (errorString == null || errorString == "");
 }
예제 #2
0
        void OnWizardCreate()
        {
            EditorUtility.DisplayProgressBar(wizardTitle, "Checking parameters...", 0.1f);

            fileSystemGameName = WizardUtilities.GetFileSystemGameName(gameName);

            EditorUtility.DisplayProgressBar(wizardTitle, "Creating folders...", 0.2f);

            // Setup folder locations
            string newGameFolder       = GetNewGameFolder();
            string newGameImagesFolder = newGameFolder + "/" + imagesFolder;

            // create missing folders
            WizardUtilities.CreateFolderIfNotExists(Application.dataPath + newGameParentFolder);
            WizardUtilities.CreateFolderIfNotExists(newGameFolder);
            WizardUtilities.CreateFolderIfNotExists(newGameImagesFolder);

            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar(wizardTitle, "Creating Minimap Generator...", 0.3f);

            GameObject minimapGenerator = new GameObject();
            Camera     camera           = minimapGenerator.AddComponent <Camera>();
            MiniMapGeneratorController miniMapGeneratorController = minimapGenerator.AddComponent <MiniMapGeneratorController>();

            EditorUtility.DisplayProgressBar(wizardTitle, "Calling Minimap Generator...", 0.4f);

            camera.clearFlags      = cameraClearFlags;
            camera.backgroundColor = backgroundColor;
            miniMapGeneratorController.mapCamera            = camera;
            miniMapGeneratorController.minimapTextureFolder = newGameImagesFolder;
            miniMapGeneratorController.pixelsPerMeter       = pixelsPerMeter;
            CreateMiniMapTextures(miniMapGeneratorController);

            AssetDatabase.Refresh();

            EditorUtility.DisplayProgressBar(wizardTitle, "Cleaning Up Minimap Generator...", 0.4f);

            UnityEngine.Object.DestroyImmediate(minimapGenerator);

            EditorUtility.ClearProgressBar();
            EditorUtility.DisplayDialog(wizardTitle, wizardTitle + " Complete! The minimap image can be found at " + newGameImagesFolder, "OK");
        }