Surfacing functions in all manager components
This commit is contained in:
48
Assets/Editor/DivingGameManagerEditor.cs
Normal file
48
Assets/Editor/DivingGameManagerEditor.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
3
Assets/Editor/DivingGameManagerEditor.cs.meta
Normal file
3
Assets/Editor/DivingGameManagerEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bbb340d8d9b4af581770757e86cc1f8
|
||||
timeCreated: 1758532258
|
||||
Reference in New Issue
Block a user