Exemple #1
0
        public override void OnGUI(MazeCreationWorkflowBackEnd backend)
        {
            if (backend.selectedMaze == null && GUILayout.Button("New"))
            {
                CreateNewPlainMaze(backend);
            }

            if (backend.selectedMaze == null)
            {
                return;
            }

            var maze = backend.selectedMaze;

            maze.name = EditorGUILayout.TextField("Name", maze.name);

            maze.MazeWidthInMeter = EditorGUILayout.FloatField("Width", maze.MazeWidthInMeter);

            maze.MazeLengthInMeter = EditorGUILayout.FloatField("Length", maze.MazeLengthInMeter);

            maze.RoomDimension = EditorGUILayout.Vector3Field("Room WxHxL (m):", maze.RoomDimension, null);

            var gridSize = beMobileMaze.CalcGridSize(maze);

            MazeEditorUtil.RebuildGrid(maze);

            EditorGUILayout.Vector2Field("Grid Cols(x) Rows(y):", gridSize, null);

            if (GUILayout.Button("Create"))
            {
                backend.selectedMaze = maze;
            }
        }
Exemple #2
0
        private void OnEnable()
        {
            var maze = target as beMobileMaze;

            if (maze.transform.childCount > 0 && !maze.Units.Any())
            {
                MazeEditorUtil.CacheUnitsIn(maze);
                EditorUtility.SetDirty(maze);
            }

            if (maze.Grid == null)
            {
                MazeEditorUtil.RebuildGrid(maze);
                EditorUtility.SetDirty(maze);
            }
        }