Rework of base interactables and managed behaviors

This commit is contained in:
Michal Pikulski
2025-11-04 11:11:27 +01:00
parent 0dc3f3e803
commit c57e3aa7e0
62 changed files with 11193 additions and 1376 deletions

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using AppleHills.Core.Interfaces;
using AppleHills.Core.Settings;
using Bootstrap;
using Core.Lifecycle;
using Core.Settings;
using Input;
using UnityEngine;
@@ -12,7 +12,7 @@ namespace Core
/// <summary>
/// Singleton manager for global game state and settings. Provides accessors for various gameplay parameters.
/// </summary>
public class GameManager : MonoBehaviour
public class GameManager : ManagedBehaviour
{
// Singleton implementation
private static GameManager _instance;
@@ -34,33 +34,33 @@ namespace Core
public event Action OnGamePaused;
public event Action OnGameResumed;
void Awake()
// ManagedBehaviour configuration
public override int ManagedAwakePriority => 10; // Core infrastructure - runs early
private new void Awake()
{
base.Awake(); // CRITICAL: Register with LifecycleManager!
// Set instance immediately so it's available before OnManagedAwake() is called
_instance = this;
// Create settings providers if it doesn't exist
// Create settings providers - must happen in Awake so other managers can access settings in their ManagedAwake
SettingsProvider.Instance.gameObject.name = "Settings Provider";
DeveloperSettingsProvider.Instance.gameObject.name = "Developer Settings Provider";
// Load all settings synchronously during Awake
// Load all settings synchronously - critical infrastructure for other managers
InitializeSettings();
InitializeDeveloperSettings();
// Register for post-boot initialization
BootCompletionService.RegisterInitAction(InitializePostBoot);
// DontDestroyOnLoad(gameObject);
}
private void Start()
{
// Load verbosity settings early
_settingsLogVerbosity = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().settingsLogVerbosity;
_managerLogVerbosity = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().gameManagerLogVerbosity;
}
private void InitializePostBoot()
protected override void OnManagedAwake()
{
// For post-boot correct initialization order
// Settings are already initialized in Awake()
// This is available for future initialization that depends on other managers
}
/// <summary>