Ejemplo n.º 1
0
        public static void OpenRegionSceneEditor(LevelRegion region = null)
        {
            previousScene = GUIAuxiliar.OpenNewScene("Region Editor", out var actualScene);
            RegionEditorWindow window = GUIAuxiliar.OpenEditorWindow <RegionEditorWindow>(Style.TITLE_REGION_EDITOR_WINDOW);

            if (String.IsNullOrEmpty(previousScene))
            {
                return;
            }


            //RegionEditorWindow window = (RegionEditorWindow)EditorWindow.GetWindow(typeof(RegionEditorWindow));

            if (!AssetDatabase.IsValidFolder(Paths.FOLDER_MAPS))
            {
                AssetDatabase.CreateFolder(Paths.FOLDER_PREFABS, Paths.NAME_MAPS);
            }
            window.ReStart();

            if (region != null)
            {
                Editlevel = region;
                window.LoadGrid();
            }

            window.FindLevel();
            Selection.activeObject = Editlevel.terrainGrid.gameObject;
            SceneView.lastActiveSceneView.FrameSelected();
            window.Show();
            //OpenWindow();
            PrefabCollectionWindow.OpenWindow();
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            var terrain = Selection.activeGameObject.GetComponent <RegionTerrain>();

            if (GUILayout.Button("Edit"))
            {
                RegionEditorWindow.OpenRegionSceneEditor(terrain.owner);
            }
        }
Ejemplo n.º 3
0
        //[MenuItem(Paths.MENU_REGION_EDITOR, false, 3)]
        //Creates the main window.
        public static void OpenWindow()
        {
            if (!AssetDatabase.IsValidFolder(Paths.FOLDER_MAPS))
            {
                AssetDatabase.CreateFolder(Paths.FOLDER_PREFABS, Paths.NAME_MAPS);
            }

            RegionEditorWindow window = (RegionEditorWindow)EditorWindow.GetWindow(typeof(RegionEditorWindow));

            window.titleContent = Style.TITLE_LEVEL_EDITOR_WINDOW;
            window.Show();
        }