feat: game over voice over

pull/320/head
Erick Zanardo 3 years ago
parent 391f9cac8f
commit 1f59772bac

@ -22,6 +22,7 @@ class GameBlocStatusListener extends Component
gameRef.overlays.remove(PinballGame.playButtonOverlay);
break;
case GameStatus.gameOver:
gameRef.player.play(PinballAudio.gameOverVoiceOver);
gameRef.descendants().whereType<Backbox>().first.requestInitials(
score: state.displayScore,
character: gameRef.characterTheme,

@ -16,6 +16,7 @@ class $AssetsSfxGen {
String get bumperA => 'assets/sfx/bumper_a.mp3';
String get bumperB => 'assets/sfx/bumper_b.mp3';
String get gameOverVoiceOver => 'assets/sfx/game_over_voice_over.mp3';
String get google => 'assets/sfx/google.mp3';
String get ioPinballVoiceOver => 'assets/sfx/io_pinball_voice_over.mp3';
}

@ -18,7 +18,10 @@ enum PinballAudio {
backgroundMusic,
/// IO Pinball voice over
ioPinballVoiceOver
ioPinballVoiceOver,
/// Game over
gameOverVoiceOver,
}
/// Defines the contract of the creation of an [AudioPool].

@ -146,6 +146,11 @@ void main() {
'packages/pinball_audio/assets/sfx/io_pinball_voice_over.mp3',
),
).called(1);
verify(
() => preCacheSingleAudio.onCall(
'packages/pinball_audio/assets/sfx/game_over_voice_over.mp3',
),
).called(1);
verify(
() => preCacheSingleAudio
.onCall('packages/pinball_audio/assets/music/background.mp3'),
@ -227,6 +232,19 @@ void main() {
});
});
group('gameOverVoiceOver', () {
test('plays the correct file', () async {
await audio.load();
audio.gameOverVoiceOver();
verify(
() => playSingleAudio.onCall(
'packages/pinball_audio/${Assets.sfx.gameOverVoiceOver}',
),
).called(1);
});
});
group('backgroundMusic', () {
test('plays the correct file', () async {
await Future.wait(player.load());

@ -128,6 +128,18 @@ void main() {
.called(1);
},
);
test(
'plays the game over voice over when it is game over',
() {
gameFlowController.onNewState(
GameState.initial().copyWith(status: GameStatus.gameOver),
);
verify(() => pinballPlayer.play(PinballAudio.gameOverVoiceOver))
.called(1);
},
);
});
});
}

Loading…
Cancel
Save