Files
AppleHillsProduction/Assets/Editor/MazeExitEditor.cs
2025-12-19 15:35:35 +01:00

90 lines
3.6 KiB
C#

using UnityEditor;
using UnityEngine;
using Minigames.TrashMaze.Objects;
namespace Editor
{
/// <summary>
/// Custom editor for MazeExit showing teleportation and camera settings
/// </summary>
[CustomEditor(typeof(MazeExit))]
public class MazeExitEditor : UnityEditor.Editor
{
private SerializedProperty _teleportTarget;
private SerializedProperty _targetCameraState;
// Base class properties
private SerializedProperty _isOneTime;
private SerializedProperty _cooldown;
private SerializedProperty _characterToInteract;
private void OnEnable()
{
_teleportTarget = serializedObject.FindProperty("teleportTarget");
_targetCameraState = serializedObject.FindProperty("targetCameraState");
// Base class properties
_isOneTime = serializedObject.FindProperty("isOneTime");
_cooldown = serializedObject.FindProperty("cooldown");
_characterToInteract = serializedObject.FindProperty("characterToInteract");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
// Draw script field (read-only)
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), GetType(), false);
EditorGUI.EndDisabledGroup();
EditorGUILayout.Space();
// Interaction Settings (from base class)
EditorGUILayout.LabelField("Interaction Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(_isOneTime);
EditorGUILayout.PropertyField(_cooldown);
EditorGUILayout.PropertyField(_characterToInteract);
EditorGUILayout.Space();
// Maze Exit Settings
EditorGUILayout.LabelField("Maze Exit Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(_teleportTarget);
if (_teleportTarget.objectReferenceValue == null)
{
EditorGUILayout.HelpBox("Assign a Transform where Pulver should be teleported to (maze exit position). Teleportation happens midway through camera blend.", MessageType.Warning);
}
else
{
EditorGUILayout.HelpBox("✓ Pulver will be teleported to this position halfway through the camera blend. Tracking target is set immediately.", MessageType.Info);
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(_targetCameraState);
EditorGUILayout.HelpBox("Camera state to blend to. Typically 'PulverGameplay' when exiting maze. Requires TrashMazeCameraController in scene.", MessageType.Info);
EditorGUILayout.Space();
// Info box about the behavior
EditorGUILayout.HelpBox(
"Maze Exit Behavior:\n" +
"1. Find Pulver (player-controlled in maze)\n" +
"2. Start camera blend to target state\n" +
"3. ★ Teleport Pulver midway through blend ★\n" +
"4. Set Pulver as tracking target immediately\n" +
"5. Wait for blend to complete\n" +
"6. Stop Pulver movement (clear cached input)\n" +
"\n" +
"Note: Does NOT switch controllers - Pulver remains player-controlled!",
MessageType.None
);
serializedObject.ApplyModifiedProperties();
}
}
}