49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
|
|
using UnityEditor;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using Minigames.DivingForPictures;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Custom editor for DivingGameManager that adds runtime buttons for testing surfacing and other functionality
|
|||
|
|
/// </summary>
|
|||
|
|
[CustomEditor(typeof(DivingGameManager))]
|
|||
|
|
public class DivingGameManagerEditor : UnityEditor.Editor
|
|||
|
|
{
|
|||
|
|
public override void OnInspectorGUI()
|
|||
|
|
{
|
|||
|
|
// Draw the default inspector
|
|||
|
|
DrawDefaultInspector();
|
|||
|
|
|
|||
|
|
// Get the target DivingGameManager
|
|||
|
|
DivingGameManager manager = (DivingGameManager)target;
|
|||
|
|
|
|||
|
|
// Add space between default inspector and custom buttons
|
|||
|
|
EditorGUILayout.Space(10);
|
|||
|
|
|
|||
|
|
// Separator line
|
|||
|
|
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
|
|||
|
|
|
|||
|
|
// Add a label for the runtime testing section
|
|||
|
|
EditorGUILayout.LabelField("Runtime Testing", EditorStyles.boldLabel);
|
|||
|
|
|
|||
|
|
// Only enable the buttons during play mode
|
|||
|
|
EditorGUI.BeginDisabledGroup(!Application.isPlaying);
|
|||
|
|
|
|||
|
|
// Add the button to call StartSurfacing
|
|||
|
|
if (GUILayout.Button("Start Surfacing", GUILayout.Height(30)))
|
|||
|
|
{
|
|||
|
|
manager.StartSurfacing();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Add a button for breaking a rope (for testing damage)
|
|||
|
|
if (GUILayout.Button("Break Rope (Test Damage)", GUILayout.Height(30)))
|
|||
|
|
{
|
|||
|
|
manager.ForceBreakRope();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
EditorGUI.EndDisabledGroup();
|
|||
|
|
|
|||
|
|
// Add explanatory text
|
|||
|
|
EditorGUILayout.HelpBox("These buttons only work in Play Mode. 'Start Surfacing' will reverse the trench direction, slow bubbles, and reverse obstacles. 'Break Rope' simulates player taking damage.", MessageType.Info);
|
|||
|
|
}
|
|||
|
|
}
|