diff --git a/packages/trashy_road/assets/audio/game_over.mp3 b/packages/trashy_road/assets/audio/game_over.mp3 new file mode 100644 index 00000000..3e98eaa4 Binary files /dev/null and b/packages/trashy_road/assets/audio/game_over.mp3 differ diff --git a/packages/trashy_road/assets/audio/stage_pass.mp3 b/packages/trashy_road/assets/audio/stage_pass.mp3 new file mode 100644 index 00000000..e4321b06 Binary files /dev/null and b/packages/trashy_road/assets/audio/stage_pass.mp3 differ diff --git a/packages/trashy_road/assets/audio/step1.mp3 b/packages/trashy_road/assets/audio/step1.mp3 index c4501ddf..1158c131 100644 Binary files a/packages/trashy_road/assets/audio/step1.mp3 and b/packages/trashy_road/assets/audio/step1.mp3 differ diff --git a/packages/trashy_road/assets/audio/steps.mp3 b/packages/trashy_road/assets/audio/steps.mp3 deleted file mode 100644 index e296620d..00000000 Binary files a/packages/trashy_road/assets/audio/steps.mp3 and /dev/null differ diff --git a/packages/trashy_road/lib/gen/assets.gen.dart b/packages/trashy_road/lib/gen/assets.gen.dart index 956eb6c4..1ce64512 100644 --- a/packages/trashy_road/lib/gen/assets.gen.dart +++ b/packages/trashy_road/lib/gen/assets.gen.dart @@ -36,6 +36,9 @@ class $AssetsAudioGen { /// File path: assets/audio/deposit_trash_5.wav String get depositTrash5 => 'assets/audio/deposit_trash_5.wav'; + /// File path: assets/audio/game_over.mp3 + String get gameOver => 'assets/audio/game_over.mp3'; + /// File path: assets/audio/hinting_arrow.mp3 String get hintingArrow => 'assets/audio/hinting_arrow.mp3'; @@ -57,6 +60,9 @@ class $AssetsAudioGen { /// File path: assets/audio/running_time.mp3 String get runningTime => 'assets/audio/running_time.mp3'; + /// File path: assets/audio/stage_pass.mp3 + String get stagePass => 'assets/audio/stage_pass.mp3'; + /// File path: assets/audio/step1.mp3 String get step1 => 'assets/audio/step1.mp3'; @@ -78,6 +84,7 @@ class $AssetsAudioGen { depositTrash3, depositTrash4, depositTrash5, + gameOver, hintingArrow, plasticBottle, ratingStars0, @@ -85,6 +92,7 @@ class $AssetsAudioGen { ratingStars2, ratingStars3, runningTime, + stagePass, step1, steps, trashCollected, diff --git a/packages/trashy_road/lib/src/audio/bloc/audio_cubit.dart b/packages/trashy_road/lib/src/audio/bloc/audio_cubit.dart index c4c79c22..5e1ab0e5 100644 --- a/packages/trashy_road/lib/src/audio/bloc/audio_cubit.dart +++ b/packages/trashy_road/lib/src/audio/bloc/audio_cubit.dart @@ -25,6 +25,8 @@ class AudioCubit extends Cubit { GameSoundEffects.ratingStars2: AudioPlayer()..audioCache = _audioCache, GameSoundEffects.ratingStars3: AudioPlayer()..audioCache = _audioCache, GameSoundEffects.runningTime: AudioPlayer()..audioCache = _audioCache, + GameSoundEffects.gameOver: AudioPlayer()..audioCache = _audioCache, + GameSoundEffects.stagePass: AudioPlayer()..audioCache = _audioCache, }; late final Map> _pools = { diff --git a/packages/trashy_road/lib/src/audio/bloc/audio_state.dart b/packages/trashy_road/lib/src/audio/bloc/audio_state.dart index d43809ca..cbeea2b8 100644 --- a/packages/trashy_road/lib/src/audio/bloc/audio_state.dart +++ b/packages/trashy_road/lib/src/audio/bloc/audio_state.dart @@ -84,17 +84,17 @@ abstract class GameSoundEffects { static final ratingStars1 = GameAudioData.fromPath( Assets.audio.ratingStars1, - volume: 0.35, + volume: 0.45, ); static final ratingStars2 = GameAudioData.fromPath( Assets.audio.ratingStars2, - volume: 0.35, + volume: 0.45, ); static final ratingStars3 = GameAudioData.fromPath( Assets.audio.ratingStars3, - volume: 0.35, + volume: 0.45, ); static final wrongBin = GameAudioData.fromPath( @@ -104,11 +104,21 @@ abstract class GameSoundEffects { static final step1 = GameAudioData.fromPath( Assets.audio.step1, - volume: 0.35, + volume: 0.2, ); static final runningTime = GameAudioData.fromPath( Assets.audio.runningTime, volume: 0.3, ); + + static final gameOver = GameAudioData.fromPath( + Assets.audio.gameOver, + volume: 0.3, + ); + + static final stagePass = GameAudioData.fromPath( + Assets.audio.stagePass, + volume: 0.2, + ); } diff --git a/packages/trashy_road/lib/src/game/view/game_page.dart b/packages/trashy_road/lib/src/game/view/game_page.dart index 7e987804..d0fae9a1 100644 --- a/packages/trashy_road/lib/src/game/view/game_page.dart +++ b/packages/trashy_road/lib/src/game/view/game_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:tiled/tiled.dart'; import 'package:trashy_road/gen/gen.dart'; +import 'package:trashy_road/src/audio/audio.dart'; import 'package:trashy_road/src/game/game.dart'; import 'package:trashy_road/src/loading/loading.dart'; import 'package:trashy_road/src/maps/maps.dart'; @@ -109,6 +110,8 @@ class _GameCompletionListener extends BlocListener { state.score != null, 'The game is completed, but the score is null.', ); + context.read().playEffect(GameSoundEffects.stagePass); + final gameMapsBloc = context.read(); final gameMap = gameMapsBloc.state.maps[state.identifier]; final scoreRating = ScoreRating.fromSteps( @@ -140,6 +143,7 @@ class _GameLostRunnedOverListener extends BlocListener { current.status == GameStatus.lost && current.lostReason == GameLostReason.vehicleRunningOver, listener: (context, state) { + context.read().playEffect(GameSoundEffects.gameOver); context.read().add(const GameResetEvent()); }, );