733 lines
24 KiB
Markdown
733 lines
24 KiB
Markdown
|
|
# ManagedBehaviour Migration Target List
|
||
|
|
|
||
|
|
**Generated:** November 3, 2025
|
||
|
|
**Purpose:** Comprehensive list of MonoBehaviours using legacy patterns that need migration to ManagedBehaviour
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Executive Summary
|
||
|
|
|
||
|
|
**Total Components Identified:** 23 unique MonoBehaviours
|
||
|
|
**Migration Priority Groups:** 3 groups (Core Services, UI Systems, Gameplay Systems)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Category 1: Core Services (HIGHEST PRIORITY)
|
||
|
|
|
||
|
|
These are the foundational systems we modified in Phases 1-2. They need migration first.
|
||
|
|
|
||
|
|
### 1.1 GameManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/GameManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has empty `InitializePostBoot()` method (no actual post-boot logic)
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
- ⚠️ Other components register IPausable with this manager
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `10` (core infrastructure)
|
||
|
|
- Move Awake logic to `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Delete empty `InitializePostBoot()` method
|
||
|
|
- No scene lifecycle hooks needed (persistent singleton)
|
||
|
|
|
||
|
|
**Dependencies:** None (can migrate immediately)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 1.2 SceneManagerService.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/SceneManagerService.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method that sets up loading screen events
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
- ✅ Exposes scene lifecycle events (SceneLoadStarted, SceneLoadCompleted, etc.)
|
||
|
|
- ⚠️ Multiple components subscribe to its events
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `15` (core infrastructure, after GameManager)
|
||
|
|
- Combine Awake + InitializeCurrentSceneTracking + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Delete `InitializePostBoot()` method
|
||
|
|
- No scene lifecycle hooks needed (persistent singleton)
|
||
|
|
|
||
|
|
**Dependencies:**
|
||
|
|
- LoadingScreenController (needs to be available in OnManagedAwake)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 1.3 SaveLoadManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/SaveLoad/SaveLoadManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` in InitializePostBoot
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
- ✅ Implements ISaveParticipant itself
|
||
|
|
- ⚠️ Components register ISaveParticipant with this manager
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `20` (core infrastructure, after SceneManagerService)
|
||
|
|
- Move Awake + InitializePostBoot logic → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- **REPLACE** SceneLoadCompleted subscription with `OnSceneReady()` hook
|
||
|
|
- Delete `InitializePostBoot()` method
|
||
|
|
- Use `OnSceneReady()` for scene-specific restore logic
|
||
|
|
|
||
|
|
**Dependencies:**
|
||
|
|
- SceneManagerService (for scene events)
|
||
|
|
- DeveloperSettingsProvider (already available)
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadCompleted` subscription → `OnSceneReady()` lifecycle hook
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 1.4 ItemManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/ItemManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadStarted` in Awake
|
||
|
|
- ✅ Has `OnSceneLoadStarted()` callback
|
||
|
|
- ❌ No BootCompletionService usage
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `50` (gameplay support system)
|
||
|
|
- Keep Awake singleton logic
|
||
|
|
- **REPLACE** SceneLoadStarted subscription with `OnSceneUnloading()` hook (use for cleanup before scene unloads)
|
||
|
|
- No InitializePostBoot
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadStarted` → `OnSceneUnloading()` (cleanup before new scene loads)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 1.5 QuickAccess.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/QuickAccess.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` conditionally
|
||
|
|
- ✅ Has `OnSceneLoadCompleted()` callback
|
||
|
|
- ❌ No BootCompletionService usage
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `60` (developer tool)
|
||
|
|
- **REPLACE** SceneLoadCompleted subscription with `OnSceneReady()` hook
|
||
|
|
- Keep conditional subscription logic
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadCompleted` → `OnSceneReady()`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 1.6 SceneOrientationEnforcer.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/SceneOrientationEnforcer.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `70` (platform-specific utility)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Category 2: UI Systems (MEDIUM PRIORITY)
|
||
|
|
|
||
|
|
UI components that manage menus, navigation, and visual feedback.
|
||
|
|
|
||
|
|
### 2.1 UIPageController.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/Core/UIPageController.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `50` (UI infrastructure)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Consider using `RegisterManagedEvent()` for UI events
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2.2 LoadingScreenController.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/LoadingScreenController.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `45` (UI infrastructure, before UIPageController - needed by SceneManagerService)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2.3 PauseMenu.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/PauseMenu.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` in InitializePostBoot
|
||
|
|
- ✅ Has `SetPauseMenuByLevel()` callback
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `60` (UI component)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REPLACE** SceneLoadCompleted subscription with `OnSceneReady()` hook
|
||
|
|
- Use `RegisterManagedEvent()` for any remaining event subscriptions
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadCompleted` → `OnSceneReady()`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2.4 CardAlbumUI.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/CardSystem/CardAlbumUI.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `80` (UI feature)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2.5 CardSystemSceneVisibility.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/CardSystem/CardSystemSceneVisibility.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot, priority: 95)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` in InitializePostBoot
|
||
|
|
- ✅ Has `OnSceneLoaded()` callback
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `95` (UI feature, matches current priority)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REPLACE** SceneLoadCompleted subscription with `OnSceneReady()` hook
|
||
|
|
- Use `RegisterManagedEvent()` for CardSystemManager events
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadCompleted` → `OnSceneReady()`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 2.6 DivingTutorial.cs
|
||
|
|
**Location:** `Assets/Scripts/UI/Tutorial/DivingTutorial.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializeTutorial)` in Awake
|
||
|
|
- ✅ Has `InitializeTutorial()` method
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `100` (tutorial system)
|
||
|
|
- Move Awake + InitializeTutorial → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Category 3: Gameplay Systems (MEDIUM-LOW PRIORITY)
|
||
|
|
|
||
|
|
Core gameplay mechanics and managers.
|
||
|
|
|
||
|
|
### 3.1 AudioManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Sound/AudioManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and IPausable
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements IPausable interface
|
||
|
|
- ✅ Manually calls `GameManager.Instance.RegisterPausableComponent(this)` in InitializePostBoot
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `30` (audio infrastructure)
|
||
|
|
- Set `AutoRegisterPausable = true` (enables auto-registration)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REMOVE** manual `RegisterPausableComponent()` call (auto-handled)
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
**Auto-Registration:**
|
||
|
|
- ✅ Implements IPausable → will auto-register with GameManager
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.2 InputManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Input/InputManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and SceneManagerService events
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` in InitializePostBoot
|
||
|
|
- ✅ Has `SwitchInputOnSceneLoaded()` callback
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `25` (input infrastructure)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REPLACE** SceneLoadCompleted subscription with `OnSceneReady()` hook
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadCompleted` → `OnSceneReady()`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.3 PlayerTouchController.cs
|
||
|
|
**Location:** `Assets/Scripts/Input/PlayerTouchController.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
- ✅ Manually calls `SaveLoadManager.Instance.RegisterParticipant(this)` in InitializePostBoot
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `100` (player control)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **KEEP** manual ISaveParticipant registration (global save data)
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Consider adding `OnSaveRequested()` / `OnRestoreRequested()` if level-specific data exists
|
||
|
|
|
||
|
|
**Note:**
|
||
|
|
- ISaveParticipant is for **global** persistent data (player state across all levels)
|
||
|
|
- If component has **level-specific** data, use OnSaveRequested/OnRestoreRequested hooks instead
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.4 FollowerController.cs
|
||
|
|
**Location:** `Assets/Scripts/Movement/FollowerController.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
- ✅ Manually calls `SaveLoadManager.Instance.RegisterParticipant(this)` in InitializePostBoot
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `110` (NPC behavior)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **KEEP** manual ISaveParticipant registration (global save data - follower state)
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Consider `OnSceneReady()` if follower needs scene-specific setup
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.5 PuzzleManager.cs
|
||
|
|
**Location:** `Assets/Scripts/PuzzleS/PuzzleManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService, SceneManagerService events, and ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadCompleted` in InitializePostBoot
|
||
|
|
- ✅ Subscribes to `SceneManagerService.SceneLoadStarted` in InitializePostBoot
|
||
|
|
- ✅ Has `OnSceneLoadCompleted()` and `OnSceneLoadStarted()` callbacks
|
||
|
|
- ✅ Uses anonymous `RegisterInitAction()` to register ISaveParticipant
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `120` (level manager - scene-specific)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REPLACE** SceneLoadCompleted with `OnSceneReady()` hook
|
||
|
|
- **REPLACE** SceneLoadStarted with `OnSceneUnloading()` hook (for cleanup)
|
||
|
|
- **CONSIDER:** Does puzzle state need to be global (ISaveParticipant) or level-specific (OnSaveRequested/OnRestoreRequested)?
|
||
|
|
- If puzzle progress persists across game sessions globally → Keep ISaveParticipant
|
||
|
|
- If puzzle progress resets per-level → Use OnSaveRequested/OnRestoreRequested
|
||
|
|
- Remove both `RegisterInitAction` calls
|
||
|
|
|
||
|
|
**Event Migration:**
|
||
|
|
- `SceneLoadStarted` → `OnSceneUnloading()` (cleanup before leaving level)
|
||
|
|
- `SceneLoadCompleted` → `OnSceneReady()` (setup when entering level)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.6 CardSystemManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Data/CardSystem/CardSystemManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
- ✅ Uses anonymous RegisterInitAction to register ISaveParticipant
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `40` (game data manager - persistent across scenes)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **KEEP** manual ISaveParticipant registration (global save data - card collection)
|
||
|
|
- Remove both `RegisterInitAction` calls
|
||
|
|
- No scene lifecycle hooks needed (persistent singleton)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.7 DialogueComponent.cs
|
||
|
|
**Location:** `Assets/Scripts/Dialogue/DialogueComponent.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `150` (dialogue system - scene-specific)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Consider `OnSceneReady()` if dialogue needs scene-specific initialization
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.8 MinigameSwitch.cs
|
||
|
|
**Location:** `Assets/Scripts/Levels/MinigameSwitch.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `140` (level transition - scene-specific)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Consider `OnSceneReady()` for scene-specific setup
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.9 DivingGameManager.cs
|
||
|
|
**Location:** `Assets/Scripts/Minigames/DivingForPictures/DivingGameManager.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and IPausable
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses `RegisterInitAction(InitializePostBoot)` in Awake
|
||
|
|
- ✅ Has `InitializePostBoot()` method
|
||
|
|
- ✅ Implements IPausable interface
|
||
|
|
- ✅ Manually calls `GameManager.Instance.RegisterPausableComponent(this)` conditionally
|
||
|
|
- ✅ Implements singleton pattern
|
||
|
|
- ⚠️ Also has its own pausable registration system for diving minigame components
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `130` (minigame manager - scene-specific)
|
||
|
|
- Set `AutoRegisterPausable = true` (conditional logic can stay in OnManagedAwake)
|
||
|
|
- Move Awake + InitializePostBoot → `OnManagedAwake()`
|
||
|
|
- **REMOVE** manual `RegisterPausableComponent()` call (auto-handled)
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
- Use `OnSceneReady()` for minigame initialization
|
||
|
|
- Use `OnSceneUnloading()` for cleanup
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.10 Pickup.cs
|
||
|
|
**Location:** `Assets/Scripts/Interactions/Pickup.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses anonymous `RegisterInitAction()` lambda in Awake
|
||
|
|
- ❌ No InitializePostBoot method (inline lambda)
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `160` (interactable - scene-specific)
|
||
|
|
- Move anonymous lambda logic into `OnManagedAwake()` override
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.11 SaveableInteractable.cs
|
||
|
|
**Location:** `Assets/Scripts/Interactions/SaveableInteractable.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
- ✅ Manually calls `SaveLoadManager.Instance.RegisterParticipant(this)` in Awake
|
||
|
|
- ❌ No BootCompletionService usage
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `170` (saveable interactable - scene-specific)
|
||
|
|
- Move ISaveParticipant registration into `OnManagedAwake()`
|
||
|
|
- **CONSIDER:** Is this global save (ISaveParticipant) or level-specific (OnSaveRequested)?
|
||
|
|
- If state persists across all levels globally → Keep ISaveParticipant
|
||
|
|
- If state is per-level → Use OnSaveRequested/OnRestoreRequested
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### 3.12 AppleMachine.cs
|
||
|
|
**Location:** `Assets/Scripts/Core/SaveLoad/AppleMachine.cs`
|
||
|
|
**Current Pattern:** MonoBehaviour with BootCompletionService and ISaveParticipant
|
||
|
|
**Usage:**
|
||
|
|
- ✅ Uses anonymous `RegisterInitAction()` lambda in Awake
|
||
|
|
- ✅ Implements ISaveParticipant interface
|
||
|
|
- ✅ Manually calls `SaveLoadManager.Instance.RegisterParticipant(this)` in lambda
|
||
|
|
|
||
|
|
**Migration Plan:**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `90` (apple machine - persistent game mechanic)
|
||
|
|
- Move anonymous lambda logic into `OnManagedAwake()` override
|
||
|
|
- **KEEP** manual ISaveParticipant registration (global save data)
|
||
|
|
- Remove `RegisterInitAction` call
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Category 4: Minigame-Specific Components (LOW PRIORITY)
|
||
|
|
|
||
|
|
These are diving minigame components that register with DivingGameManager (not global GameManager).
|
||
|
|
|
||
|
|
### 4.1 Diving Minigame IPausable Components
|
||
|
|
|
||
|
|
**Files:**
|
||
|
|
- `BottlePauser.cs` - `Assets/Scripts/Minigames/DivingForPictures/Utilities/`
|
||
|
|
- `RockPauser.cs` - `Assets/Scripts/Minigames/DivingForPictures/Utilities/`
|
||
|
|
- `ObstacleSpawner.cs` - `Assets/Scripts/Minigames/DivingForPictures/Obstacles/`
|
||
|
|
- `PlayerController.cs` - `Assets/Scripts/Minigames/DivingForPictures/Player/`
|
||
|
|
- `TrenchTileSpawner.cs` - `Assets/Scripts/Minigames/DivingForPictures/Tiles/`
|
||
|
|
- `BubbleSpawner.cs` - `Assets/Scripts/Minigames/DivingForPictures/Bubbles/`
|
||
|
|
|
||
|
|
**Current Pattern:**
|
||
|
|
- ✅ Implement IPausable interface
|
||
|
|
- ✅ Manually call `DivingGameManager.Instance.RegisterPausableComponent(this)` in Start/Awake
|
||
|
|
- ❌ No BootCompletionService usage
|
||
|
|
|
||
|
|
**Migration Plan (All):**
|
||
|
|
- Change base class to `ManagedBehaviour`
|
||
|
|
- Priority: `200+` (minigame components - scene-specific)
|
||
|
|
- Set `AutoRegisterPausable = false` (these register with DivingGameManager, not global GameManager)
|
||
|
|
- Move registration logic into `OnManagedAwake()` or `OnSceneReady()`
|
||
|
|
- **KEEP** manual registration with DivingGameManager (not global)
|
||
|
|
|
||
|
|
**Note:** These components are minigame-specific and register with DivingGameManager's local pause system, not the global GameManager. Auto-registration won't help here.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Summary Statistics
|
||
|
|
|
||
|
|
### By Category
|
||
|
|
- **Core Services:** 6 components
|
||
|
|
- **UI Systems:** 6 components
|
||
|
|
- **Gameplay Systems:** 12 components
|
||
|
|
- **Minigame Components:** 6 components (low priority)
|
||
|
|
|
||
|
|
### By Pattern Usage
|
||
|
|
- **BootCompletionService.RegisterInitAction:** 19 components
|
||
|
|
- **SceneManagerService event subscriptions:** 7 components
|
||
|
|
- **ISaveParticipant manual registration:** 7 components
|
||
|
|
- **IPausable manual registration (GameManager):** 2 components
|
||
|
|
- **IPausable manual registration (DivingGameManager):** 6 components
|
||
|
|
|
||
|
|
### Priority Distribution
|
||
|
|
- **0-20 (Core Infrastructure):** 3 components (GameManager, SceneManagerService, SaveLoadManager)
|
||
|
|
- **21-50 (Managers & UI Infrastructure):** 6 components
|
||
|
|
- **51-100 (UI Features & Gameplay Support):** 7 components
|
||
|
|
- **101-150 (Gameplay Systems):** 5 components
|
||
|
|
- **151-200+ (Scene-Specific & Minigames):** 9 components
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Migration Order Recommendation
|
||
|
|
|
||
|
|
### Phase A: Foundation (Day 1)
|
||
|
|
1. GameManager
|
||
|
|
2. SceneManagerService (depends on LoadingScreenController existing)
|
||
|
|
3. SaveLoadManager
|
||
|
|
|
||
|
|
### Phase B: Infrastructure (Day 1-2)
|
||
|
|
4. LoadingScreenController (needed by SceneManagerService)
|
||
|
|
5. AudioManager (persistent service)
|
||
|
|
6. InputManager (persistent service)
|
||
|
|
7. CardSystemManager (persistent service)
|
||
|
|
|
||
|
|
### Phase C: UI Systems (Day 2)
|
||
|
|
8. UIPageController
|
||
|
|
9. PauseMenu
|
||
|
|
10. CardAlbumUI
|
||
|
|
11. CardSystemSceneVisibility
|
||
|
|
|
||
|
|
### Phase D: Gameplay Core (Day 2-3)
|
||
|
|
12. PlayerTouchController
|
||
|
|
13. FollowerController
|
||
|
|
14. DialogueComponent
|
||
|
|
15. PuzzleManager (complex - has scene lifecycle)
|
||
|
|
|
||
|
|
### Phase E: Level Systems (Day 3)
|
||
|
|
16. MinigameSwitch
|
||
|
|
17. DivingGameManager
|
||
|
|
18. ItemManager
|
||
|
|
19. QuickAccess
|
||
|
|
20. SceneOrientationEnforcer
|
||
|
|
21. DivingTutorial
|
||
|
|
|
||
|
|
### Phase F: Interactables & Details (Day 3)
|
||
|
|
22. Pickup
|
||
|
|
23. SaveableInteractable
|
||
|
|
24. AppleMachine
|
||
|
|
25. All 6 diving minigame pausable components
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Migration Validation Checklist
|
||
|
|
|
||
|
|
For each component migrated, verify:
|
||
|
|
|
||
|
|
- [ ] Base class changed to `ManagedBehaviour`
|
||
|
|
- [ ] Priority set appropriately
|
||
|
|
- [ ] Awake + InitializePostBoot logic moved to `OnManagedAwake()`
|
||
|
|
- [ ] All `RegisterInitAction()` calls removed
|
||
|
|
- [ ] `InitializePostBoot()` method deleted
|
||
|
|
- [ ] Scene event subscriptions replaced with lifecycle hooks
|
||
|
|
- [ ] Auto-registration enabled where appropriate (IPausable)
|
||
|
|
- [ ] Manual registrations kept where needed (ISaveParticipant for global data)
|
||
|
|
- [ ] Scene lifecycle hooks added if component is scene-specific
|
||
|
|
- [ ] Managed events used for any remaining subscriptions
|
||
|
|
- [ ] Component compiles without errors
|
||
|
|
- [ ] Component tested in play mode
|
||
|
|
- [ ] Functionality verified unchanged
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Key Migration Patterns
|
||
|
|
|
||
|
|
### Pattern 1: Simple BootCompletionService User
|
||
|
|
**Before:**
|
||
|
|
```csharp
|
||
|
|
void Awake()
|
||
|
|
{
|
||
|
|
// Setup
|
||
|
|
BootCompletionService.RegisterInitAction(InitializePostBoot);
|
||
|
|
}
|
||
|
|
|
||
|
|
private void InitializePostBoot()
|
||
|
|
{
|
||
|
|
// Post-boot initialization
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**After:**
|
||
|
|
```csharp
|
||
|
|
protected override void OnManagedAwake()
|
||
|
|
{
|
||
|
|
// Setup + Post-boot initialization combined
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Pattern 2: Scene Event Subscriber
|
||
|
|
**Before:**
|
||
|
|
```csharp
|
||
|
|
private void InitializePostBoot()
|
||
|
|
{
|
||
|
|
SceneManagerService.Instance.SceneLoadCompleted += OnSceneLoaded;
|
||
|
|
}
|
||
|
|
|
||
|
|
void OnDestroy()
|
||
|
|
{
|
||
|
|
SceneManagerService.Instance.SceneLoadCompleted -= OnSceneLoaded;
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnSceneLoaded(string sceneName)
|
||
|
|
{
|
||
|
|
// Handle scene load
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**After:**
|
||
|
|
```csharp
|
||
|
|
protected override void OnSceneReady()
|
||
|
|
{
|
||
|
|
// Handle scene load - no subscription needed!
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Pattern 3: IPausable Auto-Registration
|
||
|
|
**Before:**
|
||
|
|
```csharp
|
||
|
|
private void InitializePostBoot()
|
||
|
|
{
|
||
|
|
GameManager.Instance.RegisterPausableComponent(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
void OnDestroy()
|
||
|
|
{
|
||
|
|
GameManager.Instance.UnregisterPausableComponent(this);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**After:**
|
||
|
|
```csharp
|
||
|
|
protected override bool AutoRegisterPausable => true;
|
||
|
|
|
||
|
|
// That's it! Auto-handled by ManagedBehaviour
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Pattern 4: ISaveParticipant (Keep Manual for Global Data)
|
||
|
|
**Before:**
|
||
|
|
```csharp
|
||
|
|
private void InitializePostBoot()
|
||
|
|
{
|
||
|
|
SaveLoadManager.Instance.RegisterParticipant(this);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**After:**
|
||
|
|
```csharp
|
||
|
|
protected override void OnManagedAwake()
|
||
|
|
{
|
||
|
|
// Keep manual registration for global persistent data
|
||
|
|
SaveLoadManager.Instance.RegisterParticipant(this);
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
**Note:** If data is level-specific instead, use `OnSaveRequested()` / `OnRestoreRequested()` hooks instead of ISaveParticipant.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Questions to Answer During Migration
|
||
|
|
|
||
|
|
For each component with ISaveParticipant:
|
||
|
|
- Is this **global** persistent data (player inventory, settings, overall progress)?
|
||
|
|
- → Keep ISaveParticipant pattern
|
||
|
|
- Is this **level-specific** data (puzzle state in current level, enemy positions)?
|
||
|
|
- → Remove ISaveParticipant, use OnSaveRequested/OnRestoreRequested hooks
|
||
|
|
|
||
|
|
For each component subscribing to scene events:
|
||
|
|
- Does it need to run on **every scene load**?
|
||
|
|
- → Use `OnSceneReady()`
|
||
|
|
- Does it need to clean up **before scene unloads**?
|
||
|
|
- → Use `OnSceneUnloading()`
|
||
|
|
- Does it need to initialize when **component spawns** (even mid-game)?
|
||
|
|
- → Use `OnManagedAwake()`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**End of Migration Target List**
|
||
|
|
|