Commit Graph

44 Commits

Author SHA1 Message Date
e27bb7bfb6 Refactor interactions, introduce template-method lifecycle management, work on save-load system (#51)
# Lifecycle Management & Save System Revamp

## Overview
Complete overhaul of game lifecycle management, interactable system, and save/load architecture. Introduces centralized `ManagedBehaviour` base class for consistent initialization ordering and lifecycle hooks across all systems.

## Core Architecture

### New Lifecycle System
- **`LifecycleManager`**: Centralized coordinator for all managed objects
- **`ManagedBehaviour`**: Base class replacing ad-hoc initialization patterns
  - `OnManagedAwake()`: Priority-based initialization (0-100, lower = earlier)
  - `OnSceneReady()`: Scene-specific setup after managers ready
  - Replaces `BootCompletionService` (deleted)
- **Priority groups**: Infrastructure (0-20) → Game Systems (30-50) → Data (60-80) → UI/Gameplay (90-100)
- **Editor support**: `EditorLifecycleBootstrap` ensures lifecycle works in editor mode

### Unified SaveID System
- Consistent format: `{ParentName}_{ComponentType}`
- Auto-registration via `AutoRegisterForSave = true`
- New `DebugSaveIds` editor tool for inspection

## Save/Load Improvements

### Enhanced State Management
- **Extended SaveLoadData**: Unlocked minigames, card collection states, combination items, slot occupancy
- **Async loading**: `ApplyCardCollectionState()` waits for card definitions before restoring
- **New `SaveablePlayableDirector`**: Timeline sequences save/restore playback state
- **Fixed race conditions**: Proper initialization ordering prevents data corruption

## Interactable & Pickup System

- Migrated to `OnManagedAwake()` for consistent initialization
- Template method pattern for state restoration (`RestoreInteractionState()`)
- Fixed combination item save/load bugs (items in slots vs. follower hand)
- Dynamic spawning support for combined items on load
- **Breaking**: `Interactable.Awake()` now sealed, use `OnManagedAwake()` instead

##  UI System Changes

- **AlbumViewPage** and **BoosterNotificationDot**: Migrated to `ManagedBehaviour`
- **Fixed menu persistence bug**: Menus no longer reappear after scene transitions
- **Pause Menu**: Now reacts to all scene loads (not just first scene)
- **Orientation Enforcer**: Enforces per-scene via `SceneManagementService`
- **Loading Screen**: Integrated with new lifecycle

## ⚠️ Breaking Changes

1. **`BootCompletionService` removed** → Use `ManagedBehaviour.OnManagedAwake()` with priority
2. **`Interactable.Awake()` sealed** → Override `OnManagedAwake()` instead
3. **SaveID format changed** → Now `{ParentName}_{ComponentType}` consistently
4. **MonoBehaviours needing init ordering** → Must inherit from `ManagedBehaviour`

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Reviewed-on: #51
2025-11-07 15:38:31 +00:00
Michal Pikulski
43779c560e Cleanup compile warnings, cleanup logs, spruce up level selection menu 2025-10-28 14:31:17 +01:00
Michal Pikulski
cc797f09ef Update the rotation enforcement to automatically lock device into
desired orientation.
2025-10-24 16:48:45 +02:00
5a85a602bd Revamp game pausing and input handling. Fix minigame tutorial and end sequence. (#39)
- Revamp pausing and centralize management in GameManager
- Switch Pause implementation to be counter-based to solve corner case of multiple pause requests
- Remove duplicated Pause logic from other components
- Add pausing when browsing the card album
- Fully deliver the exclusive UI implementation
- Spruce up the MiniGame tutorial with correct pausing, hiding other UI
- Correctly unpause after showing tutorial
- Fix minigame ending sequence. The cinematic correctly plays only once now
- Replaying the minigame works

Co-authored-by: Michal Adam Pikulski <michal@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Reviewed-on: #39
2025-10-24 11:09:32 +00:00
Michal Adam Pikulski
35acaddca5 FIx the issue of end game screen appearing twice 2025-10-22 11:50:24 +02:00
Michal Adam Pikulski
00f6d2c6c6 Add a dirty booster pack opening sequence 2025-10-21 15:40:47 +02:00
Michal Adam Pikulski
af77e07f99 Update the cards to pull in from addressables to wokr in build, remove erronous code preventing building 2025-10-21 10:29:06 +02:00
journaliciouz
d1792014db Added feedback on photography in diving game 2025-10-20 23:18:31 +02:00
journaliciouz
84dd8004d5 Monster Approach and react audio 2025-10-20 22:33:39 +02:00
9df43b8f53 Implemented Flash Feedback to the Diving Minigame 2025-10-20 16:19:08 +02:00
6e5a6c049f Underwater rushed audio job 2025-10-17 16:31:23 +02:00
Michal Pikulski
74339d7c47 Fix pausing etc. issues in the minigame 2025-10-17 13:18:49 +02:00
Michal Pikulski
b2384269e5 Update the Pause menu flow to be slightly less scoffed 2025-10-16 23:19:33 +02:00
journaliciouz
09ae4b5ba7 WIP 2 2025-10-16 22:45:13 +02:00
journaliciouz
4fc005b082 WIP 2025-10-16 22:35:23 +02:00
eab8899720 WIP game over diving 2025-10-16 16:23:48 +02:00
8c4f821865 Merge branch 'main' into diving-outrocinematic 2025-10-16 15:40:08 +02:00
Michal Pikulski
cc6e89c003 Fix issue with event triggering multiple times at the end of the minigame 2025-10-15 23:20:38 +02:00
b425d2b4f4 Stuck cinematics 2025-10-15 17:35:34 +02:00
5f46c963b5 Implemented Diving tutorial 2025-10-15 15:58:19 +02:00
DamianCorazza
782e068575 Monster Animations and monster flipping according to which wall it's coming from 2025-10-14 21:00:03 +02:00
Michal Pikulski
e8180b21bf Strip debug logging from the game, fix screen weirdness 2025-10-14 15:54:11 +02:00
Michal Pikulski
21bec076a9 [Bug] Fix the issue with input being blocked after missed camera sequence 2025-10-14 11:48:19 +02:00
9c44a0c91f photo_input_switch (#27)
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #27
2025-10-14 07:09:16 +00:00
2573e7f80e Add a system for setting up "real" camera framing to work between devices (#26)
- In-level authoring utility to designate level bounds
- Camera Adapter component to be placed on a level's camera to perform the adjustments
- EdgeAnchor tool, which allows anchoring of game objects to the screen bounds

Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Reviewed-on: #26
2025-10-14 04:56:00 +00:00
57652b87f6 Merge branch 'main' into DamianBranch 2025-10-10 16:49:25 +02:00
Michal Pikulski
0c5546efd2 Add backbone for card creation and implement Camera minigame mechanics 2025-10-10 14:49:42 +02:00
1fe48c995b Commmit minigame and tile logic 2025-10-10 14:45:23 +02:00
Michal Pikulski
0e17516df7 Add a pausable interface and make minigameobjecs pausable 2025-10-08 12:36:08 +02:00
Michal Pikulski
328e8dea0a Finalize normalized movement settings 2025-10-07 09:42:59 +02:00
Michal Pikulski
348e982930 Use normalized movement settings 2025-10-07 09:28:41 +02:00
Michal Pikulski
f1f4234c2a Wait for correct screen orientation 2025-09-30 13:13:37 +02:00
e878a32263 Introduce input modes and Pause Menu (#8)
- Add input mode switching to the Input Manager
- Automatically set input mode on scene load - UI for MainMenu and GameAndUI for other scenes
- Add PauseMenu prefab, auto-loaded via the boostrap system
- Automatically control PauseMenu visibility based on current scene

Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #8
2025-09-25 10:06:51 +00:00
63cb3f1a8c Revamp the settings system (#7)
- A Settings Provider system to utilize addressables for loading settings at runtime
- An editor UI for easy modifications of the settings objects
- A split out developer settings functionality to keep gameplay and nitty-gritty details separately
- Most settings migrated out of game objects and into the new system
- An additional Editor utility for fetching the settings at editor runtime, for gizmos, visualization etc

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Reviewed-on: #7
2025-09-24 13:33:43 +00:00
1a9c82f5d7 Touch up touch input 2025-09-22 15:01:53 +02:00
da07f778c3 Move around scripts to cleanup the Minigame structure 2025-09-22 14:50:51 +02:00
5305c20b00 Create a diving minigame MVP (#6)
- Obstacles
- Tiles
- Object pooling
- Monster spawns
- Scoring
- Minigame End

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Reviewed-on: #6
2025-09-22 12:16:32 +00:00
46755fecb3 Populate minigame with obstacles and monster spawns (#5)
- Simulated "fake" physics and collisions
- Object pooling for tiles, obstacles and monster spawns
- Base monster scoring with proximity triggers and depth multiplier

Co-authored-by: AlexanderT <alexander@foolhardyhorizons.com>
Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Reviewed-on: #5
2025-09-21 07:32:56 +00:00
2ec5c3d855 Working monster spawns 2025-09-19 13:46:24 +02:00
d110616907 Add Monster Spawn points, monster head placeholders. Add utility for prefab variation by sprite selection. 2025-09-19 12:51:25 +02:00
Michal Pikulski
75be338065 Working generic object pooling, pool monitor editor tool and batch component adder editor tool 2025-09-16 15:02:57 +02:00
Michal Pikulski
bcc6f05058 Working single-purpose object pooling solution 2025-09-16 15:02:57 +02:00
Michal Pikulski
e0af6b999d [DivingForPictures] Tile spawning prototype for descending minigame 2025-09-10 12:35:29 +02:00
Michal Pikulski
2dfe6de144 Updates and reworks, code rewrites 2025-09-10 12:35:29 +02:00