Rework of base interactables and managed behaviors
This commit is contained in:
committed by
Michal Pikulski
parent
00e1746ac4
commit
f88bd0e2c9
@@ -1,7 +1,3 @@
|
||||
using AppleHills.Core.Settings;
|
||||
using Bootstrap;
|
||||
using Core;
|
||||
using PuzzleS;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using AppleHills.Core;
|
||||
@@ -9,8 +5,9 @@ using AppleHills.Core.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using AudioSourceEvents;
|
||||
using System;
|
||||
using Core.Lifecycle;
|
||||
|
||||
public class AudioManager : MonoBehaviour, IPausable
|
||||
public class AudioManager : ManagedBehaviour, IPausable
|
||||
{
|
||||
/// <summary>
|
||||
/// Play all audio, just music or no audio at all when the game is paused.
|
||||
@@ -42,18 +39,21 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
/// </summary>
|
||||
public static AudioManager Instance => _instance;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
// ManagedBehaviour configuration
|
||||
public override int ManagedAwakePriority => 30; // Audio infrastructure
|
||||
public override bool AutoRegisterPausable => true; // Auto-register as IPausable
|
||||
|
||||
// Register for post-boot initialization
|
||||
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||||
GameManager.Instance.RegisterPausableComponent(this);
|
||||
private new void Awake()
|
||||
{
|
||||
base.Awake(); // CRITICAL: Register with LifecycleManager!
|
||||
|
||||
// Set instance immediately so it's available before OnManagedAwake() is called
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
private void InitializePostBoot()
|
||||
protected override void OnManagedAwake()
|
||||
{
|
||||
|
||||
// Auto-registration with GameManager handled by ManagedBehaviour
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
|
||||
Reference in New Issue
Block a user