Remove dependencies on legacy variables in GameManager.Instance
This commit is contained in:
@@ -3,6 +3,7 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using AppleHills.Core.Settings; // Added for IInteractionSettings
|
||||
|
||||
namespace Input
|
||||
{
|
||||
@@ -44,6 +45,9 @@ namespace Input
|
||||
}
|
||||
}
|
||||
|
||||
// Settings reference
|
||||
private IInteractionSettings _interactionSettings;
|
||||
|
||||
private PlayerInput playerInput;
|
||||
private InputAction tapMoveAction;
|
||||
private InputAction holdMoveAction;
|
||||
@@ -55,6 +59,10 @@ namespace Input
|
||||
{
|
||||
_instance = this;
|
||||
// DontDestroyOnLoad(gameObject);
|
||||
|
||||
// Initialize settings reference
|
||||
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
|
||||
|
||||
playerInput = GetComponent<PlayerInput>();
|
||||
if (playerInput == null)
|
||||
{
|
||||
@@ -217,7 +225,7 @@ namespace Input
|
||||
/// </summary>
|
||||
private bool TryDelegateToInteractable(Vector2 worldPos)
|
||||
{
|
||||
LayerMask mask = GameManager.Instance != null ? GameManager.Instance.InteractableLayerMask : -1;
|
||||
LayerMask mask = _interactionSettings != null ? _interactionSettings.InteractableLayerMask : -1;
|
||||
Collider2D hit = Physics2D.OverlapPoint(worldPos, mask);
|
||||
if (hit != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user