Remove dependencies on legacy variables in GameManager.Instance
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user