Fix the sound bird interactaiblity issues.

This commit is contained in:
Michal Pikulski
2025-11-24 11:41:47 +01:00
parent f0abc4760b
commit e33de5da3d
10 changed files with 252 additions and 341 deletions

View File

@@ -85,9 +85,17 @@ namespace Core.SaveLoad
private void OnApplicationQuit()
{
if (DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().useSaveLoadSystem)
var debugSettings = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>();
// 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)");
}
}

View File

@@ -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()
{

View File

@@ -38,6 +38,11 @@ namespace Interactions
protected FollowerController FollowerController;
private bool isActive = true;
/// <summary>
/// Gets whether this interactable is currently active (can be clicked)
/// </summary>
public bool IsActive => isActive;
// Action component system
private List<InteractionActionBase> _registeredActions = new List<InteractionActionBase>();
@@ -443,6 +448,14 @@ namespace Interactions
isActive = true;
}
/// <summary>
/// Enable or disable this interactable
/// </summary>
public void SetActive(bool active)
{
isActive = active;
}
#endregion
#region Legacy Methods & Compatibility

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 81aa592db4b598c4cbfb7faf604e0d62
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
using Core.SaveLoad;
using Interactions;
using UnityEngine;
namespace StateMachines.Quarry.SoundBird
{
/// <summary>
/// Idle state for the Sound Bird - bird is landed and slot is interactable
/// </summary>
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");
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cfd3b894d78129b4aa5310e5ce9cceae