void Editing() { EditorGUILayout.LabelField("MAKING ROOM SHAPE!"); if (Selection.activeGameObject != null && Selection.activeGameObject.activeInHierarchy) { if (Selection.activeGameObject.GetComponent <ObjectSelector>() == null) { if (Selection.activeTransform.parent != null) { if (Selection.activeTransform.parent.GetComponent <ObjectSelector>() != null) { Selection.activeTransform = Selection.activeTransform.parent; } } } if (Selection.activeGameObject.GetComponent <ObjectSelector>() != null) { EditorGUILayout.LabelField("Currently selected object: ", Selection.activeGameObject.name); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Duplicate UP")) { Duplicate(Selection.activeGameObject, new Vector2(0, 4)); } if (GUILayout.Button("Duplicate DOWN")) { Duplicate(Selection.activeGameObject, new Vector2(0, -4)); } if (GUILayout.Button("Duplicate LEFT")) { Duplicate(Selection.activeGameObject, new Vector2(-4, 0)); } if (GUILayout.Button("Duplicate RIGHT")) { Duplicate(Selection.activeGameObject, new Vector2(4, 0));; } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Delete")) { DestroyImmediate(Selection.activeGameObject); return; } } else { EditorGUILayout.LabelField("No duplicatable object selected"); GUILayout.Space(42); } if (GUILayout.Button("Focus")) { SceneView.lastActiveSceneView.FrameSelected(); } if (Selection.activeGameObject.GetComponent <FloorSelector>() != null) { EditorGUILayout.LabelField("Floor selected"); if (GUILayout.Button("Wall")) { Selection.activeGameObject = RM.NewWall(Selection.activeTransform.position); } if (GUILayout.Button("OuterCornor")) { Selection.activeGameObject = RM.NewOuter(Selection.activeTransform.position); } if (GUILayout.Button("Door")) { Selection.activeGameObject = RM.NewDoor(Selection.activeTransform.position); } if (GUILayout.Button("REPLACE with inner cornor")) { GameObject temp = RM.NewInner(Selection.activeTransform.position); DestroyImmediate(Selection.activeGameObject); Selection.activeGameObject = temp; } } if (Selection.activeGameObject.GetComponent <FloorSelector>() != null || Selection.activeGameObject.GetComponent <WallSelector>() != null || Selection.activeGameObject.GetComponent <OuterCornorSelector>() != null || Selection.activeGameObject.GetComponent <InnerCornorSelector>() != null || Selection.activeGameObject.GetComponent <Door>() != null) { EditorGUILayout.LabelField("Rotable Object Selected."); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("+90")) { Selection.activeTransform.Rotate(new Vector3(0, 90, 0)); } if (GUILayout.Button("180")) { Selection.activeTransform.Rotate(new Vector3(0, 180, 0)); } if (GUILayout.Button("-90")) { Selection.activeTransform.Rotate(new Vector3(0, -90, 0)); } EditorGUILayout.EndHorizontal(); if (Selection.activeGameObject.GetComponent <WallSelector>() != null) { EditorGUILayout.LabelField("Replaceble object selected."); if (GUILayout.Button("Replace with Door")) { GameObject temp = RM.NewDoor(Selection.activeTransform.position); temp.transform.rotation = Selection.activeTransform.rotation; DestroyImmediate(Selection.activeGameObject); Selection.activeGameObject = temp; } } if (Selection.activeGameObject.GetComponent <Door>() != null) { EditorGUILayout.LabelField("Replaceble object selected."); if (GUILayout.Button("Replace with Wall")) { GameObject temp = RM.NewWall(Selection.activeTransform.position); temp.transform.rotation = Selection.activeTransform.rotation; DestroyImmediate(Selection.activeGameObject); Selection.activeGameObject = temp; } } } } else { EditorGUILayout.LabelField("No Object selected"); GUILayout.Space(64); } GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace(); objectToCreate = EditorGUILayout.Popup("Create new object: ", objectToCreate, new string[] { "Select", "Floor", "Wall", "InnerCornor", "OuterCornor", "Door" }); if (Selection.activeTransform != null) { tempPos = Selection.activeTransform.position; } else { tempPos = Vector3.zero; } switch (objectToCreate) { case 1: Selection.activeGameObject = RM.NewFloor(tempPos); objectToCreate = 0; break; case 2: Selection.activeGameObject = RM.NewWall(tempPos); objectToCreate = 0; break; case 3: Selection.activeGameObject = RM.NewInner(tempPos); objectToCreate = 0; break; case 4: Selection.activeGameObject = RM.NewOuter(tempPos); objectToCreate = 0; break; case 5: Selection.activeGameObject = RM.NewDoor(tempPos); objectToCreate = 0; break; default: break; } GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Clear!", GUILayout.Height(50)) && EditorUtility.DisplayDialog("Clear?", "Are you sure you want to clear the current room? Will erase any unsaved changes!", "I am sure", "Cancel")) { RM.DestroyRoom(); } if (GUILayout.Button("Save!", GUILayout.Height(50))) { RM.GetRoom().CleanData(); RM.GetRoom().UpdateLists(); roomName = RM.GetName(); if (RM.GetRoom().canBeRoom()) { states = States.Saving; } } EditorGUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create interior", GUILayout.Height(50))) { states = States.Props; } if (GUILayout.Button("Create decor", GUILayout.Height(50))) { states = States.Decor; } EditorGUILayout.EndHorizontal(); }