Remove dependencies on legacy variables in GameManager.Instance

This commit is contained in:
Michal Pikulski
2025-10-07 10:44:26 +02:00
parent c46036dce6
commit f845673eca
9 changed files with 113 additions and 89 deletions

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
using AppleHills.Core.Settings; // Added for IInteractionSettings
namespace PuzzleS
{
@@ -21,6 +22,9 @@ namespace PuzzleS
private Transform _playerTransform;
private Coroutine _proximityCheckCoroutine;
// Settings reference
private IInteractionSettings _interactionSettings;
/// <summary>
/// Singleton instance of the PuzzleManager.
/// </summary>
@@ -58,6 +62,9 @@ namespace PuzzleS
_instance = this;
// DontDestroyOnLoad(gameObject);
SceneManager.sceneLoaded += OnSceneLoaded;
// Initialize settings reference
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
}
void Start()
@@ -123,8 +130,8 @@ namespace PuzzleS
{
if (_playerTransform != null)
{
// Get the proximity threshold from settings (half of the prompt range)
float proximityThreshold = GameManager.Instance.DefaultPuzzlePromptRange;
// Get the proximity threshold from settings directly using our settings reference
float proximityThreshold = _interactionSettings?.DefaultPuzzlePromptRange ?? 3.0f;
// Check distance to each step behavior
foreach (var kvp in _stepBehaviours)