public override void OnInspectorGUI() { EditorGUILayout.Space(); int spawnMode = (int)instance.spawnMode; cont = new GUIContent("Spawn Mode:", "Spawn mode in this level"); contList = new GUIContent[spawnModeLabel.Length]; for (int i = 0; i < contList.Length; i++) { contList[i] = new GUIContent(spawnModeLabel[i], spawnModeTooltip[i]); } spawnMode = EditorGUILayout.Popup(cont, spawnMode, contList); instance.spawnMode = (SpawnManager._SpawnMode)spawnMode; cont = new GUIContent("Allow Skip:", "Allow player to skip ahead and spawn the next wave"); instance.allowSkip = EditorGUILayout.Toggle(cont, instance.allowSkip); cont = new GUIContent("Auto Start: ", "Check to have the spawning start on a fixed timer. Rather than waiting for player initiation"); instance.autoStart = EditorGUILayout.Toggle(cont, instance.autoStart); if (instance.autoStart) { cont = new GUIContent(" - Start Delay: ", "The duration to wait in second before the spawning start"); instance.autoStartDelay = EditorGUILayout.FloatField(cont, instance.autoStartDelay); } cont = new GUIContent("Auto-Gen Wave:", "Check to have the SpawnManager automatically generate the wave in runtime as opposed to using preset data"); instance.procedurallyGenerateWave = EditorGUILayout.Toggle(cont, instance.procedurallyGenerateWave); cont = new GUIContent("Default Path:", "The primary path to be used. Every creep will follow this path unless an alternate path is specified in a sub-wave"); instance.defaultPath = (PathTD)EditorGUILayout.ObjectField(cont, instance.defaultPath, typeof(PathTD), true); EditorGUILayout.Space(); EditorGUILayout.HelpBox("Editing of spawnInfo via Inspector is not recommended. Please use SpawnEditorWindow instead", MessageType.Info); if (GUILayout.Button("Open SpawnEditorWindow")) { SpawnEditorWindow.Init(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("", GUILayout.MaxWidth(10)); showDefaultFlag = EditorGUILayout.Foldout(showDefaultFlag, "Show default editor"); EditorGUILayout.EndHorizontal(); if (showDefaultFlag) { DrawDefaultInspector(); } if (GUI.changed) { EditorUtility.SetDirty(instance); } }
static void OpenSpawnEditor() { SpawnEditorWindow.Init(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (instance == null) { Awake(); return; } GUI.changed = false; Undo.RecordObject(instance, "SpawnManager"); EditorGUILayout.Space(); cont = new GUIContent("Endless Mode:", "Check to enable endless mode"); instance.endlessMode = EditorGUILayout.Toggle(cont, instance.endlessMode); cont = new GUIContent("Generate On Start:", "Check to have the waves regenerated at the start of game. All preset setting will be overwritten."); if (instance.endlessMode) { EditorGUILayout.LabelField("Generate On Start:", "-"); } else { instance.genWaveOnStart = EditorGUILayout.Toggle(cont, instance.genWaveOnStart); } int spawnCDType = (int)instance.spawnCDType; cont = new GUIContent("Spawn CD Type:", "Spawn CD Type used in this level"); contL = TDE.SetupContL(spawnCDTypeLabel, spawnCDTypeTooltip); spawnCDType = EditorGUILayout.Popup(cont, spawnCDType, contL); instance.spawnCDType = (SpawnManager._SpawnCDType)spawnCDType; cont = new GUIContent("Skippable:", "Allow player to skip ahead and spawn the next wave"); if (instance.spawnCDType == SpawnManager._SpawnCDType.None) { EditorGUILayout.LabelField("Skippable:", "-"); } else { instance.skippable = EditorGUILayout.Toggle(cont, instance.skippable); } cont = new GUIContent("Auto Start:", "Check to start the game on a timer instead of waiting for player initiation"); instance.autoStart = EditorGUILayout.Toggle(cont, instance.autoStart); cont = new GUIContent(" - Start Timer:", "Delay in second before the spawn start automatically"); if (!instance.autoStart) { EditorGUILayout.LabelField(" - Start Timer:", "-"); } else { instance.startTimer = EditorGUILayout.FloatField(cont, instance.startTimer); } EditorGUILayout.Space(); EditorGUILayout.HelpBox("Editing wave Information using Inspector is not recommended.\nPlease use SpawnEditorWindow instead", MessageType.Info); if (GUILayout.Button("Open SpawnEditorWindow")) { SpawnEditorWindow.Init(); } EditorGUILayout.Space(); DefaultInspector(); if (GUI.changed) { EditorUtility.SetDirty(instance); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GUI.changed = false; Undo.RecordObject(instance, "SpawnManager"); EditorGUILayout.Space(); int spawnMode = (int)instance.spawnMode; cont = new GUIContent("Spawn Mode:", "Spawn mode in this level"); contL = new GUIContent[spawnModeLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(spawnModeLabel[i], spawnModeTooltip[i]); } spawnMode = EditorGUILayout.Popup(cont, spawnMode, contL); instance.spawnMode = (SpawnManager._SpawnMode)spawnMode; int spawnLimit = (int)instance.spawnLimit; cont = new GUIContent("Spawn Count:", "Spawn count in this level. Infinite (endless mode) must use procedural wave generation"); contL = new GUIContent[spawnLimitLabel.Length]; for (int i = 0; i < contL.Length; i++) { contL[i] = new GUIContent(spawnLimitLabel[i], spawnLimitTooltip[i]); } spawnLimit = EditorGUILayout.Popup(cont, spawnLimit, contL); instance.spawnLimit = (SpawnManager._SpawnLimit)spawnLimit; cont = new GUIContent("Allow Skip:", "Allow player to skip ahead and spawn the next wave"); instance.allowSkip = EditorGUILayout.Toggle(cont, instance.allowSkip); EditorGUILayout.Space(); cont = new GUIContent("Auto Start: ", "Check to have the spawning start on a fixed timer. Rather than waiting for player initiation"); instance.autoStart = EditorGUILayout.Toggle(cont, instance.autoStart); cont = new GUIContent(" - Start Delay: ", "The duration to wait in second before the spawning start"); if (instance.autoStart) { instance.autoStartDelay = EditorGUILayout.FloatField(cont, instance.autoStartDelay); } else { EditorGUILayout.LabelField(cont, new GUIContent("-", "")); } EditorGUILayout.Space(); cont = new GUIContent("Auto-Gen Wave:", "Check to have the SpawnManager automatically generate the wave in runtime as opposed to using preset data"); if (instance.spawnLimit == SpawnManager._SpawnLimit.Finite) { instance.procedurallyGenerateWave = EditorGUILayout.Toggle(cont, instance.procedurallyGenerateWave); } else { EditorGUILayout.LabelField(cont, new GUIContent("-", "")); } cont = new GUIContent("Default Path:", "The primary path to be used. Every creep will follow this path unless an alternate path is specified in a sub-wave"); instance.defaultPath = (PathTD)EditorGUILayout.ObjectField(cont, instance.defaultPath, typeof(PathTD), true); EditorGUILayout.Space(); EditorGUILayout.HelpBox("Editing Spawn Information using Inspector is not recommended.\nPlease use SpawnEditorWindow instead", MessageType.Info); if (GUILayout.Button("Open SpawnEditorWindow")) { SpawnEditorWindow.Init(); } EditorGUILayout.Space(); DefaultInspector(); if (GUI.changed) { EditorUtility.SetDirty(instance); } }