Create a diving minigame MVP (#6)
- Obstacles - Tiles - Object pooling - Monster spawns - Scoring - Minigame End Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com> Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com> Reviewed-on: #6
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
|
||||
42
Assets/Editor/TrenchTileSpawnerEditor.cs
Normal file
42
Assets/Editor/TrenchTileSpawnerEditor.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Minigames.DivingForPictures;
|
||||
|
||||
/// <summary>
|
||||
/// Custom editor for TrenchTileSpawner that adds a runtime button to test the StartSurfacing function
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(TrenchTileSpawner))]
|
||||
public class TrenchTileSpawnerEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
// Draw the default inspector
|
||||
DrawDefaultInspector();
|
||||
|
||||
// Get the target TrenchTileSpawner
|
||||
TrenchTileSpawner spawner = (TrenchTileSpawner)target;
|
||||
|
||||
// Add space between default inspector and custom button
|
||||
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 button during play mode
|
||||
EditorGUI.BeginDisabledGroup(!Application.isPlaying);
|
||||
|
||||
// Add the button to call StartSurfacing
|
||||
if (GUILayout.Button("Start Surfacing", GUILayout.Height(30)))
|
||||
{
|
||||
spawner.StartSurfacing();
|
||||
}
|
||||
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
// Add explanatory text
|
||||
EditorGUILayout.HelpBox("This button will reverse the direction of the trench movement, making the player surface instead of descend. Only works in Play Mode.", MessageType.Info);
|
||||
}
|
||||
}
|
||||
3
Assets/Editor/TrenchTileSpawnerEditor.cs.meta
Normal file
3
Assets/Editor/TrenchTileSpawnerEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fb1a138e45d4720ba5c95da894b4491
|
||||
timeCreated: 1758531024
|
||||
Reference in New Issue
Block a user