using Minigames.Airplane.Interactive; using UnityEditor; namespace Editor.CustomEditorsAndDrawers { [CustomEditor(typeof(AirplaneBouncySurface))] public class AirplaneBouncySurfaceEditor : UnityEditor.Editor { private SerializedProperty _bounceMultiplierProp; private SerializedProperty _bounceDirectionProp; private SerializedProperty _useReflectionProp; private SerializedProperty _minBounceVelocityProp; private SerializedProperty _maxBounceVelocityProp; private SerializedProperty _bounceAnimatorProp; private SerializedProperty _bounceTriggerProp; private SerializedProperty _bounceSoundProp; private SerializedProperty _showDebugLogsProp; private void OnEnable() { _bounceMultiplierProp = serializedObject.FindProperty("bounceMultiplier"); _bounceDirectionProp = serializedObject.FindProperty("bounceDirection"); _useReflectionProp = serializedObject.FindProperty("useReflection"); _minBounceVelocityProp = serializedObject.FindProperty("minBounceVelocity"); _maxBounceVelocityProp = serializedObject.FindProperty("maxBounceVelocity"); _bounceAnimatorProp = serializedObject.FindProperty("bounceAnimator"); _bounceTriggerProp = serializedObject.FindProperty("bounceTrigger"); _bounceSoundProp = serializedObject.FindProperty("bounceSound"); _showDebugLogsProp = serializedObject.FindProperty("showDebugLogs"); } public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.LabelField("Bounce Configuration", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_bounceMultiplierProp); EditorGUILayout.PropertyField(_useReflectionProp); // Grey out bounceDirection when useReflection is true bool isReflectionEnabled = _useReflectionProp.boolValue; EditorGUI.BeginDisabledGroup(isReflectionEnabled); EditorGUILayout.PropertyField(_bounceDirectionProp); EditorGUI.EndDisabledGroup(); if (isReflectionEnabled) { EditorGUILayout.HelpBox("Bounce direction is used as surface normal for reflection when 'Use Reflection' is enabled.", MessageType.Info); } else { EditorGUILayout.HelpBox("Plane will be launched directly in the specified direction (no reflection).", MessageType.Info); } EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField("Optional Modifiers", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_minBounceVelocityProp); EditorGUILayout.PropertyField(_maxBounceVelocityProp); EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField("Visual Feedback (Optional)", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_bounceAnimatorProp); EditorGUILayout.PropertyField(_bounceTriggerProp); EditorGUILayout.PropertyField(_bounceSoundProp); EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField("Debug", EditorStyles.boldLabel); EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_showDebugLogsProp); EditorGUI.indentLevel--; serializedObject.ApplyModifiedProperties(); } } }