Delegate all audio management to the new audio package, then manage that through a new wolf3d class
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:wolf_3d_data/wolf_3d_data.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
import 'package:wolf_3d_synth/wolf_3d_synth.dart';
|
||||
|
||||
class Wolf3d {
|
||||
Wolf3d._();
|
||||
@@ -12,6 +13,9 @@ class Wolf3d {
|
||||
final List<WolfensteinData> availableGames = [];
|
||||
WolfensteinData? _activeGame;
|
||||
|
||||
// --- Core Systems ---
|
||||
final WolfAudio audio = WolfAudio();
|
||||
|
||||
// --- Getters ---
|
||||
WolfensteinData get activeGame {
|
||||
if (_activeGame == null) {
|
||||
@@ -20,6 +24,15 @@ class Wolf3d {
|
||||
return _activeGame!;
|
||||
}
|
||||
|
||||
// --- Episode ---
|
||||
int _activeEpisode = 0;
|
||||
|
||||
int get activeEpisode => _activeEpisode;
|
||||
|
||||
void setActiveEpisode(int episodeIndex) {
|
||||
_activeEpisode = episodeIndex;
|
||||
}
|
||||
|
||||
// Convenience getters for the active game's assets
|
||||
List<WolfLevel> get levels => activeGame.levels;
|
||||
List<Sprite> get walls => activeGame.walls;
|
||||
@@ -36,6 +49,7 @@ class Wolf3d {
|
||||
|
||||
/// Initializes the engine by loading available game data.
|
||||
Future<void> init({String? directory}) async {
|
||||
await audio.init();
|
||||
availableGames.clear();
|
||||
|
||||
// 1. Bundle asset loading (migrated from GameSelectScreen)
|
||||
|
||||
Reference in New Issue
Block a user