From e33de5da3d359e07fe483c6a50b706d17e77cb15 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Mon, 24 Nov 2025 11:41:47 +0100 Subject: [PATCH] Fix the sound bird interactaiblity issues. --- .../Settings/DeveloperSettingsEditorWindow.cs | 68 ++++-- Assets/Prefabs/Environment/SoundBird.prefab | 223 +++++++++--------- Assets/Scenes/Levels/Quarry.unity | 217 +---------------- .../Scripts/Core/SaveLoad/SaveLoadManager.cs | 10 +- .../Core/Settings/Developer/DebugSettings.cs | 6 +- Assets/Scripts/Interactions/Interactable.cs | 13 + .../StateMachines/Quarry/SoundBird.meta | 8 + .../Quarry/SoundBird/IdleState.cs | 45 ++++ .../Quarry/SoundBird/IdleState.cs.meta | 2 + Assets/Settings/Developer/DebugSettings.asset | 1 + 10 files changed, 252 insertions(+), 341 deletions(-) create mode 100644 Assets/Scripts/StateMachines/Quarry/SoundBird.meta create mode 100644 Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs create mode 100644 Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs.meta diff --git a/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs b/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs index 0a29302f..6ee5f482 100644 --- a/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs +++ b/Assets/Editor/Settings/DeveloperSettingsEditorWindow.cs @@ -2,7 +2,6 @@ using UnityEditor; using System.Collections.Generic; using System.Linq; -using System.IO; namespace AppleHills.Core.Settings.Editor { @@ -164,23 +163,31 @@ namespace AppleHills.Core.Settings.Editor EditorGUILayout.Space(10); - // Draw all properties - SerializedProperty property = serializedObj.GetIterator(); - bool enterChildren = true; - while (property.NextVisible(enterChildren)) + // Special handling for DebugSettings + if (settings is DebugSettings) { - enterChildren = false; - - // Skip the script field - if (property.name == "m_Script") continue; - - // Group headers - if (property.isArray && property.propertyType == SerializedPropertyType.Generic) + DrawDebugSettingsEditor(serializedObj, settings as DebugSettings); + } + else + { + // Draw all properties for other settings types + SerializedProperty property = serializedObj.GetIterator(); + bool enterChildren = true; + while (property.NextVisible(enterChildren)) { - EditorGUILayout.LabelField(property.displayName, EditorStyles.boldLabel); + enterChildren = false; + + // Skip the script field + if (property.name == "m_Script") continue; + + // Group headers + if (property.isArray && property.propertyType == SerializedPropertyType.Generic) + { + EditorGUILayout.LabelField(property.displayName, EditorStyles.boldLabel); + } + + EditorGUILayout.PropertyField(property, true); } - - EditorGUILayout.PropertyField(property, true); } // Apply changes @@ -196,6 +203,37 @@ namespace AppleHills.Core.Settings.Editor } } + private void DrawDebugSettingsEditor(SerializedObject serializedObj, DebugSettings debugSettings) + { + SerializedProperty property = serializedObj.GetIterator(); + bool enterChildren = true; + bool useSaveLoadSystem = debugSettings.UseSaveLoadSystem; + + while (property.NextVisible(enterChildren)) + { + enterChildren = false; + + // Skip the script field + if (property.name == "m_Script") continue; + + // Check if this property should be disabled + bool shouldDisable = false; + if (!useSaveLoadSystem) + { + // Disable save-load related options when useSaveLoadSystem is false + if (property.name == "autoClearSaves" || property.name == "dontSaveOnQuit") + { + shouldDisable = true; + } + } + + // Disable GUI for dependent fields + EditorGUI.BeginDisabledGroup(shouldDisable); + EditorGUILayout.PropertyField(property, true); + EditorGUI.EndDisabledGroup(); + } + } + // Helper method to highlight important fields private void DrawHighlightedProperty(SerializedProperty property, string tooltip = null) { diff --git a/Assets/Prefabs/Environment/SoundBird.prefab b/Assets/Prefabs/Environment/SoundBird.prefab index 8d87a7c6..364381fc 100644 --- a/Assets/Prefabs/Environment/SoundBird.prefab +++ b/Assets/Prefabs/Environment/SoundBird.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1702819536151974707} - m_Layer: 10 + m_Layer: 0 m_Name: AnnaLiseSpotSong m_TagString: Untagged m_Icon: {fileID: 0} @@ -41,13 +41,11 @@ GameObject: m_Component: - component: {fileID: 2523333015159032981} - component: {fileID: 8875860401447896107} - - component: {fileID: 5057760771402457000} - - component: {fileID: 2433130051631076285} - component: {fileID: 7290110366808972859} - component: {fileID: 9196152289301358918} - - component: {fileID: 2596311128101197840} - m_Layer: 10 - m_Name: SoundBird_Slot + - component: {fileID: 7004860270194965002} + m_Layer: 0 + m_Name: SoundBird m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -68,6 +66,7 @@ Transform: m_Children: - {fileID: 3907351184805552114} - {fileID: 1702819536151974707} + - {fileID: 2513116580733004004} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!212 &8875860401447896107 @@ -128,109 +127,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!61 &5057760771402457000 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 588897581313790951} - m_Enabled: 1 - serializedVersion: 3 - m_Density: 1 - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_ForceSendLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ForceReceiveLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_ContactCaptureLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_CallbackLayers: - serializedVersion: 2 - m_Bits: 4294967295 - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_CompositeOperation: 0 - m_CompositeOrder: 0 - m_Offset: {x: 0, y: 1.2} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0.5, y: 0.5} - oldSize: {x: 1.86, y: 3.25} - newSize: {x: 2.21, y: 3.91} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - m_Size: {x: 3.5, y: 4.5} - m_EdgeRadius: 0 ---- !u!114 &2433130051631076285 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 588897581313790951} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ec1a2e6e32f746c4990c579e13b79104, type: 3} - m_Name: - m_EditorClassIdentifier: - isOneTime: 0 - cooldown: -1 - characterToInteract: 2 - interactionStarted: - m_PersistentCalls: - m_Calls: [] - interactionInterrupted: - m_PersistentCalls: - m_Calls: [] - characterArrived: - m_PersistentCalls: - m_Calls: [] - interactionComplete: - m_PersistentCalls: - m_Calls: [] - itemData: {fileID: 11400000, guid: d28f5774afad9d14f823601707150700, type: 2} - iconRenderer: {fileID: 8875860401447896107} - slottedItemRenderers: [] - onItemSlotted: - m_PersistentCalls: - m_Calls: [] - onItemSlotRemoved: - m_PersistentCalls: - m_Calls: [] - onCorrectItemSlotted: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 0} - m_TargetAssemblyTypeName: AnneLiseBehaviour, AppleHillsScripts - m_MethodName: GotoSpot - m_Mode: 2 - m_Arguments: - m_ObjectArgument: {fileID: 588897581313790951} - m_ObjectArgumentAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - onIncorrectItemSlotted: - m_PersistentCalls: - m_Calls: [] - onForbiddenItemSlotted: - m_PersistentCalls: - m_Calls: [] --- !u!114 &7290110366808972859 MonoBehaviour: m_ObjectHideFlags: 0 @@ -267,7 +163,7 @@ Animator: m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorStateOnDisable: 0 m_WriteDefaultValuesOnDisable: 0 ---- !u!114 &2596311128101197840 +--- !u!114 &7004860270194965002 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -276,9 +172,10 @@ MonoBehaviour: m_GameObject: {fileID: 588897581313790951} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 95e46aacea5b42888ee7881894193c11, type: 3} + m_Script: {fileID: 11500000, guid: cfd3b894d78129b4aa5310e5ce9cceae, type: 3} m_Name: - m_EditorClassIdentifier: AppleHillsScripts::Core.SaveLoad.AppleState + m_EditorClassIdentifier: AppleHillsScripts::StateMachines.Quarry.SoundBird.IdleState + itemSlot: {fileID: 0} --- !u!1 &4624889622840393752 GameObject: m_ObjectHideFlags: 0 @@ -304,13 +201,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4624889622840393752} serializedVersion: 2 - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.28, y: 0.57, z: 0} - m_LocalScale: {x: 0.6666667, y: 0.6666667, z: 0.6666667} + m_LocalRotation: {x: 0, y: 0, z: -0.075422555, w: 0.9971517} + m_LocalPosition: {x: -0.27, y: 2.37, z: 0} + m_LocalScale: {x: 0.336075, y: 0.336075, z: 0.336075} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2523333015159032981} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -8.651} --- !u!212 &6941190210788968874 SpriteRenderer: m_ObjectHideFlags: 0 @@ -369,3 +266,97 @@ SpriteRenderer: m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!1 &6117389795918759898 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2513116580733004004} + m_Layer: 0 + m_Name: AnimContainer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2513116580733004004 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6117389795918759898} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.13, y: 3.48, z: 0} + m_LocalScale: {x: 0.33, y: 0.33, z: 0.33} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 5133773671673172183} + m_Father: {fileID: 2523333015159032981} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &814760252274833115 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 2513116580733004004} + m_Modifications: + - target: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_Name + value: NextStepIndicator + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} +--- !u!4 &5133773671673172183 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} + m_PrefabInstance: {fileID: 814760252274833115} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scenes/Levels/Quarry.unity b/Assets/Scenes/Levels/Quarry.unity index 3408b28d..e6df4287 100644 --- a/Assets/Scenes/Levels/Quarry.unity +++ b/Assets/Scenes/Levels/Quarry.unity @@ -432118,72 +432118,10 @@ Transform: m_CorrespondingSourceObject: {fileID: 9067462609398217044, guid: 6cbcaf4eb20e63e4fb462f6fb1ada3a7, type: 3} m_PrefabInstance: {fileID: 286519576} m_PrefabAsset: {fileID: 0} ---- !u!1001 &287904381 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 726450010} - m_Modifications: - - target: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_Name - value: NextStepIndicator - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} ---- !u!4 &287904382 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 5507990123417429516, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - m_PrefabInstance: {fileID: 287904381} - m_PrefabAsset: {fileID: 0} --- !u!1 &287904383 stripped GameObject: - m_CorrespondingSourceObject: {fileID: 5383276844808284485, guid: afbb486e5456a20479aee4cf8bc949b6, type: 3} - m_PrefabInstance: {fileID: 287904381} + m_CorrespondingSourceObject: {fileID: 4754571837807058846, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} + m_PrefabInstance: {fileID: 1399567329} m_PrefabAsset: {fileID: 0} --- !u!1001 &289703776 PrefabInstance: @@ -442023,38 +441961,6 @@ MonoBehaviour: audioSource: {fileID: 0} clipPriority: 0 sourcePriority: 0 ---- !u!1 &726450009 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 726450010} - m_Layer: 0 - m_Name: AnimContainer - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &726450010 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 726450009} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.13, y: 3.48, z: 0} - m_LocalScale: {x: 0.33, y: 0.33, z: 0.33} - m_ConstrainProportionsScale: 1 - m_Children: - - {fileID: 287904382} - m_Father: {fileID: 1399567330} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &733706664 stripped Transform: m_CorrespondingSourceObject: {fileID: 6078012632802010276, guid: 3346526f3046f424196615241a307104, type: 3} @@ -452521,7 +452427,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1252594309 Transform: m_ObjectHideFlags: 0 @@ -455783,74 +455689,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 368957768} m_Modifications: - - target: {fileID: 22512726373136855, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_Layer - value: 0 - objectReference: {fileID: 0} - target: {fileID: 588897581313790951, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} propertyPath: m_Name value: SoundBird_Slot objectReference: {fileID: 0} - - target: {fileID: 588897581313790951, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_Layer - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 588897581313790951, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.size - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_Mode - value: 6 - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_Mode - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_Target - value: - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_Target - value: - objectReference: {fileID: 2078227529} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_CallState - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName - value: birdCanHear - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName - value: TakePhoto - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName - value: soundBird_CanFly, AppleHillsScripts - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_TargetAssemblyTypeName - value: StateMachines.Quarry.AnneLise.AnneLiseBushBehaviour, AppleHillsScripts - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgument - value: - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - - target: {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: onCorrectItemSlotted.m_PersistentCalls.m_Calls.Array.data[1].m_Arguments.m_ObjectArgumentAssemblyTypeName - value: UnityEngine.Object, UnityEngine - objectReference: {fileID: 0} - target: {fileID: 2523333015159032981, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} propertyPath: m_LocalPosition.x value: 0.04 @@ -455891,54 +455733,13 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalScale.x - value: 0.336075 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalScale.y - value: 0.336075 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalScale.z - value: 0.336075 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalPosition.x - value: -0.27 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalPosition.y - value: 2.37 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalRotation.w - value: 0.9971517 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalRotation.z - value: -0.075422555 - objectReference: {fileID: 0} - - target: {fileID: 3907351184805552114, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: -8.651 - objectReference: {fileID: 0} - m_RemovedComponents: - - {fileID: 2433130051631076285, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - - {fileID: 5057760771402457000, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} + - target: {fileID: 7004860270194965002, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} + propertyPath: itemSlot + value: + objectReference: {fileID: 1923065567} + m_RemovedComponents: [] m_RemovedGameObjects: [] - m_AddedGameObjects: - - targetCorrespondingSourceObject: {fileID: 2523333015159032981, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} - insertIndex: -1 - addedObject: {fileID: 726450010} + m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9ad58c5e86338824db8a6daebdb432b5, type: 3} --- !u!4 &1399567330 stripped diff --git a/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs b/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs index 78a9d3d1..4b6ec769 100644 --- a/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs +++ b/Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs @@ -85,9 +85,17 @@ namespace Core.SaveLoad private void OnApplicationQuit() { - if (DeveloperSettingsProvider.Instance.GetSettings().useSaveLoadSystem) + var debugSettings = DeveloperSettingsProvider.Instance.GetSettings(); + + // Only save if the save system is enabled AND dontSaveOnQuit is false + if (debugSettings.UseSaveLoadSystem && !debugSettings.DontSaveOnQuit) { Save(); + Logging.Debug("[SaveLoadManager] Saving on application quit"); + } + else if (debugSettings.DontSaveOnQuit) + { + Logging.Debug("[SaveLoadManager] Skipping save on quit (dontSaveOnQuit enabled)"); } } diff --git a/Assets/Scripts/Core/Settings/Developer/DebugSettings.cs b/Assets/Scripts/Core/Settings/Developer/DebugSettings.cs index 6f2d7846..19f8b678 100644 --- a/Assets/Scripts/Core/Settings/Developer/DebugSettings.cs +++ b/Assets/Scripts/Core/Settings/Developer/DebugSettings.cs @@ -29,10 +29,12 @@ namespace AppleHills.Core.Settings [SerializeField] public bool pauseTimeOnPauseGame = true; [Header("Save Load Options")] - [Tooltip("Should use save laod system?")] + [Tooltip("Should use save load system?")] [SerializeField] public bool useSaveLoadSystem = true; [Tooltip("Automatically clear all saves before entering play mode in editor")] [SerializeField] public bool autoClearSaves = false; + [Tooltip("Load saves on start but don't save/overwrite data on exit")] + [SerializeField] public bool dontSaveOnQuit = false; [Header("Logging Options")] [Tooltip("Logging level for bootstrap services")] @@ -51,7 +53,9 @@ namespace AppleHills.Core.Settings // Property getters public bool ShowDebugUiMessages => showDebugUiMessages; public bool PauseTimeOnPauseGame => pauseTimeOnPauseGame; + public bool UseSaveLoadSystem => useSaveLoadSystem; public bool AutoClearSaves => autoClearSaves; + public bool DontSaveOnQuit => dontSaveOnQuit; public override void OnValidate() { diff --git a/Assets/Scripts/Interactions/Interactable.cs b/Assets/Scripts/Interactions/Interactable.cs index d97f7c3a..0903a7cd 100644 --- a/Assets/Scripts/Interactions/Interactable.cs +++ b/Assets/Scripts/Interactions/Interactable.cs @@ -38,6 +38,11 @@ namespace Interactions protected FollowerController FollowerController; private bool isActive = true; + /// + /// Gets whether this interactable is currently active (can be clicked) + /// + public bool IsActive => isActive; + // Action component system private List _registeredActions = new List(); @@ -443,6 +448,14 @@ namespace Interactions isActive = true; } + /// + /// Enable or disable this interactable + /// + public void SetActive(bool active) + { + isActive = active; + } + #endregion #region Legacy Methods & Compatibility diff --git a/Assets/Scripts/StateMachines/Quarry/SoundBird.meta b/Assets/Scripts/StateMachines/Quarry/SoundBird.meta new file mode 100644 index 00000000..8b604201 --- /dev/null +++ b/Assets/Scripts/StateMachines/Quarry/SoundBird.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 81aa592db4b598c4cbfb7faf604e0d62 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs b/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs new file mode 100644 index 00000000..2b446fa1 --- /dev/null +++ b/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs @@ -0,0 +1,45 @@ +using Core.SaveLoad; +using Interactions; +using UnityEngine; + +namespace StateMachines.Quarry.SoundBird +{ + /// + /// Idle state for the Sound Bird - bird is landed and slot is interactable + /// + public class IdleState : AppleState + { + [Header("Slot Reference")] + [Tooltip("The item slot that should be enabled when the bird is idle")] + [SerializeField] private ItemSlot itemSlot; + + public override void OnEnterState() + { + // Enable the slot when the bird lands (enters idle) + if (itemSlot != null) + { + itemSlot.SetActive(true); + Debug.Log($"[IdleState] Enabled ItemSlot: {itemSlot.gameObject.name}"); + } + else + { + Debug.LogWarning("[IdleState] ItemSlot reference is null - cannot enable slot"); + } + } + + private void OnDisable() + { + // Disable the slot when the bird takes off + if (itemSlot != null) + { + itemSlot.SetActive(false); + Debug.Log($"[IdleState] Disabled ItemSlot: {itemSlot.gameObject.name}"); + } + else + { + Debug.LogWarning("[IdleState] ItemSlot reference is null - cannot disable slot"); + } + } + } +} + diff --git a/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs.meta b/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs.meta new file mode 100644 index 00000000..4d4b9c01 --- /dev/null +++ b/Assets/Scripts/StateMachines/Quarry/SoundBird/IdleState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cfd3b894d78129b4aa5310e5ce9cceae \ No newline at end of file diff --git a/Assets/Settings/Developer/DebugSettings.asset b/Assets/Settings/Developer/DebugSettings.asset index dfb88eef..0fa6f0dd 100644 --- a/Assets/Settings/Developer/DebugSettings.asset +++ b/Assets/Settings/Developer/DebugSettings.asset @@ -16,6 +16,7 @@ MonoBehaviour: pauseTimeOnPauseGame: 0 useSaveLoadSystem: 1 autoClearSaves: 0 + dontSaveOnQuit: 0 bootstrapLogVerbosity: 0 settingsLogVerbosity: 0 gameManagerLogVerbosity: 0