First steps

This commit is contained in:
Michal Pikulski
2025-10-01 14:35:17 +02:00
parent a6c63af911
commit dac119fd7b
30 changed files with 806 additions and 9 deletions

View File

@@ -22,7 +22,8 @@ namespace AppleHills.Editor
// Set up the delegates in SettingsAccess
AppleHills.SettingsAccess.SetupEditorProviders(
GetPlayerStopDistance,
GetPlayerStopDistanceDirectInteraction
GetPlayerStopDistanceDirectInteraction,
GetPuzzlePromptRange
);
// Subscribe to asset changes to auto-refresh when settings are modified
@@ -58,7 +59,8 @@ namespace AppleHills.Editor
// Re-register the delegates in case they were lost
AppleHills.SettingsAccess.SetupEditorProviders(
GetPlayerStopDistance,
GetPlayerStopDistanceDirectInteraction
GetPlayerStopDistanceDirectInteraction,
GetPuzzlePromptRange
);
Debug.Log("Editor settings loaded for Scene View use");
@@ -81,6 +83,11 @@ namespace AppleHills.Editor
return _interactionSettings?.PlayerStopDistanceDirectInteraction ?? 2.0f;
}
private static float GetPuzzlePromptRange()
{
return _interactionSettings?.DefaultPuzzlePromptRange ?? 3.0f;
}
// Other utility methods
public static T GetSettings<T>() where T : BaseSettings
{

View File

@@ -0,0 +1,57 @@
using UnityEngine;
using UnityEditor;
using AppleHills.Editor;
using AppleHills.Core.Settings;
namespace PuzzleS.Editor
{
[CustomEditor(typeof(ObjectiveStepBehaviour))]
public class ObjectiveStepBehaviourEditor : UnityEditor.Editor
{
private SerializedProperty stepDataProperty;
private SerializedProperty indicatorPrefabProperty;
private SerializedProperty drawPromptRangeGizmoProperty;
private void OnEnable()
{
stepDataProperty = serializedObject.FindProperty("stepData");
indicatorPrefabProperty = serializedObject.FindProperty("indicatorPrefab");
drawPromptRangeGizmoProperty = serializedObject.FindProperty("drawPromptRangeGizmo");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
// Draw default inspector properties
EditorGUILayout.PropertyField(stepDataProperty);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Indicator Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(indicatorPrefabProperty);
EditorGUILayout.PropertyField(drawPromptRangeGizmoProperty);
// Add button to create default indicator
EditorGUILayout.Space();
if (GUILayout.Button("Create Default Indicator"))
{
var interactionSettings = EditorSettingsProvider.GetSettings<InteractionSettings>();
if (interactionSettings != null && interactionSettings.DefaultPuzzleIndicatorPrefab != null)
{
indicatorPrefabProperty.objectReferenceValue = interactionSettings.DefaultPuzzleIndicatorPrefab;
serializedObject.ApplyModifiedProperties();
Debug.Log("Default puzzle indicator prefab assigned from settings");
}
else
{
Debug.LogWarning("Default puzzle indicator prefab not set in InteractionSettings!");
EditorUtility.DisplayDialog("No Default Indicator",
"The default puzzle indicator prefab is not set in the InteractionSettings asset.", "OK");
}
}
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ba55b805a871449e9429e1a210f22fed
timeCreated: 1759312523