Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

feat: new step sound #308

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added packages/trashy_road/assets/audio/step1.mp3
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/trashy_road/lib/gen/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/trashy_road/lib/src/audio/bloc/audio_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class AudioCubit extends Cubit<AudioState> {
};

late final Map<GameAudioData, Future<AudioPool>> _pools = {
GameSoundEffects.steps: AudioPool.create(
source: GameSoundEffects.steps.source,
GameSoundEffects.step1: AudioPool.create(
source: GameSoundEffects.step1.source,
maxPlayers: 6,
audioCache: _audioCache,
),
Expand Down
15 changes: 4 additions & 11 deletions packages/trashy_road/lib/src/audio/bloc/audio_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,22 @@ class GameAudioData extends Equatable {
const GameAudioData._({
required this.source,
required this.volume,
this.duration,
});

GameAudioData.fromPath(
String path, {
required double volume,
Duration? duration,
}) : this._(
source: AssetSource(path),
volume: volume,
duration: duration,
);

final AssetSource source;

final double volume;

final Duration? duration;

@override
List<Object?> get props => [source, volume, duration];
List<Object?> get props => [source, volume];
}

abstract class GameBackgroundMusic {
Expand Down Expand Up @@ -105,13 +100,11 @@ abstract class GameSoundEffects {
static final wrongBin = GameAudioData.fromPath(
Assets.audio.wrongBin,
volume: 0.35,
duration: const Duration(seconds: 1),
);

static final steps = GameAudioData.fromPath(
Assets.audio.steps,
volume: 0.12,
duration: const Duration(milliseconds: 820),
static final step1 = GameAudioData.fromPath(
Assets.audio.step1,
volume: 0.35,
);

static final runningTime = GameAudioData.fromPath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class PlayerMovingBehavior extends Behavior<Player>
parent.position.setFrom(_targetPosition);
_previousPosition.setFrom(_targetPosition);

game.audioBloc.playEffect(GameSoundEffects.steps);
game.audioBloc.playEffect(GameSoundEffects.step1);
}
}

Expand Down
Loading