/// <summary> /// ステージの読み込み /// </summary> /// <param name="stageEditor">ベースクラス</param> private void LoadStage(StageEditor_uchimura stageEditor) { stageEditor.loadStage = true; stageEditor.Data = pre; stageEditor.stageName = stageEditor.Data.stageName; GameObject o = Instantiate(pre.stage); stageEditor.gridPos = new GameObject[pre.gridCells.x, pre.gridCells.y, pre.gridCells.z]; stageEditor._StageObjects = new GameObject[pre.gridCells.x, pre.gridCells.y, pre.gridCells.z]; stageEditor.EditStageInit(); ReStart: foreach (Transform child in o.transform) { child.gameObject.transform.parent = stageEditor.stageRoot.transform; Vector3Int v = child.GetComponent <MyCellIndex>().cellIndex; stageEditor.gridPos[v.x, v.y, v.z].GetComponent <HighlightObject>().IsAlreadyInstalled = true; stageEditor._StageObjects[v.x, v.y, v.z] = child.gameObject; } if (o.transform.childCount != 0) { goto ReStart; } Destroy(o); }
public override void OnInspectorGUI() { StageEditor_uchimura stageEditor = target as StageEditor_uchimura; base.OnInspectorGUI(); GUILayout.Label("-以下変更可-"); pre = (PrefabStageData)EditorGUILayout.ObjectField("読み込むステージ", pre, typeof(ScriptableObject), false); if (GUILayout.Button("NewStage")) { if (!EditorApplication.isPlaying) { return; } stageEditor.EditStageInit(); stageEditor.isCreateStage = true; } if (GUILayout.Button("LoadStage")) { if (!EditorApplication.isPlaying) { return; } LoadStage(stageEditor); stageEditor.isCreateStage = true; } }