Revamp the prompt system, the bootstrapper system, the starting cinematic

This commit is contained in:
Michal Pikulski
2025-10-16 19:43:19 +02:00
parent df604fbc03
commit 50448c5bd3
89 changed files with 3964 additions and 677 deletions

View File

@@ -5,6 +5,7 @@ using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using AppleHills.Core.Settings;
using Bootstrap;
using Core; // Added for IInteractionSettings
namespace Input
@@ -35,22 +36,10 @@ namespace Input
// Track which consumer is handling the current hold operation
private ITouchInputConsumer _activeHoldConsumer;
public static InputManager Instance
{
get
{
if (_instance == null && Application.isPlaying && !_isQuitting)
{
_instance = FindAnyObjectByType<InputManager>();
if (_instance == null)
{
var go = new GameObject("InputManager");
_instance = go.AddComponent<InputManager>();
}
}
return _instance;
}
}
/// <summary>
/// Singleton instance of the InputManager. No longer creates an instance if one doesn't exist.
/// </summary>
public static InputManager Instance => _instance;
// Settings reference
private IInteractionSettings _interactionSettings;
@@ -66,6 +55,15 @@ namespace Input
{
_instance = this;
// Register for post-boot initialization
BootCompletionService.RegisterInitAction(InitializePostBoot);
}
private void InitializePostBoot()
{
// Subscribe to scene load completed events now that boot is complete
SceneManagerService.Instance.SceneLoadCompleted += SwitchInputOnSceneLoaded;
// Initialize settings reference
_interactionSettings = GameManager.GetSettingsObject<IInteractionSettings>();
@@ -78,12 +76,25 @@ namespace Input
tapMoveAction = playerInput.actions.FindAction("TapMove", false);
holdMoveAction = playerInput.actions.FindAction("HoldMove", false);
positionAction = playerInput.actions.FindAction("TouchPosition", false);
}
private void Start()
{
// SceneManagerService.Instance.SceneLoadCompleted += SwitchInputOnSceneLoaded;
if (tapMoveAction != null)
tapMoveAction.performed += OnTapMovePerformed;
if (holdMoveAction != null)
{
holdMoveAction.performed += OnHoldMoveStarted;
holdMoveAction.canceled += OnHoldMoveCanceled;
}
SwitchInputOnSceneLoaded(SceneManager.GetActiveScene().name);
Logging.Debug("[InputManager] Subscribed to SceneManagerService events");
}
private void OnDestroy()
{
// Unsubscribe from SceneManagerService
if (SceneManagerService.Instance != null)
SceneManagerService.Instance.SceneLoadCompleted -= SwitchInputOnSceneLoaded;
}
private void SwitchInputOnSceneLoaded(string sceneName)
@@ -122,17 +133,6 @@ namespace Input
break;
}
}
void OnEnable()
{
if (tapMoveAction != null)
tapMoveAction.performed += OnTapMovePerformed;
if (holdMoveAction != null)
{
holdMoveAction.performed += OnHoldMoveStarted;
holdMoveAction.canceled += OnHoldMoveCanceled;
}
}
void OnDisable()
{
@@ -149,7 +149,7 @@ namespace Input
{
_isQuitting = true;
}
/// <summary>
/// Sets the default ITouchInputConsumer to receive input events.
/// </summary>