Load menu and level audio dynamically
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -69,11 +69,15 @@ class _WolfRendererState extends State<WolfRenderer>
|
||||
// Grab the specific level from the singleton
|
||||
_currentLevel = Wolf3d.I.levels[mapIndex];
|
||||
|
||||
// Play the exact track id Software intended for this level!
|
||||
Wolf3d.I.audio.playLevelMusic(_currentLevel);
|
||||
|
||||
// TODO: Initialize player position, spawn enemies based on difficulty, etc.
|
||||
debugPrint("Loaded Level: ${_currentLevel.name}");
|
||||
}
|
||||
|
||||
void _onLevelCompleted() {
|
||||
Wolf3d.I.audio.stopMusic();
|
||||
// When the player hits the elevator switch, advance the map
|
||||
setState(() {
|
||||
_currentMapIndex++;
|
||||
|
||||
@@ -22,16 +22,13 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (Wolf3d.I.music.isNotEmpty) {
|
||||
Wolf3d.I.audio.playMusic(Wolf3d.I.music.first);
|
||||
}
|
||||
Wolf3d.I.audio.playMenuMusic();
|
||||
}
|
||||
|
||||
void _selectEpisode(int index) {
|
||||
Wolf3d.I.setActiveEpisode(index);
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
// We pass the audio handles so the next screen can stop them when the game starts
|
||||
builder: (context) => DifficultyScreen(),
|
||||
),
|
||||
);
|
||||
@@ -39,7 +36,6 @@ class _EpisodeScreenState extends State<EpisodeScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Determine how many episodes are available (10 levels per episode)
|
||||
final int numberOfEpisodes = (Wolf3d.I.levels.length / 10).floor().clamp(
|
||||
1,
|
||||
6,
|
||||
|
||||
Reference in New Issue
Block a user