add bike start sound when entering vehicle

This commit is contained in:
yuni 2024-03-28 14:19:53 +01:00
parent f4aea80f34
commit 8c3fa09b5c
3 changed files with 6 additions and 1 deletions

View file

@ -70,6 +70,7 @@ More information here: https://bevy-cheatbook.github.io/setup/cross/linux-window
- https://pixabay.com/sound-effects/data-transmission-sound-from-14664-72309
- https://pixabay.com/sound-effects/thrusters-loopwav-14699
- https://pixabay.com/sound-effects/rocket-loop-99748
- https://pixabay.com/sound-effects/350cc-bike-firing-32391
- Star chart based on the [HYG Stellar database](https://github.com/astronexus/HYG-Database)
- Custom font Yupiter is based on:
- Noto Sans Symbols 2, Copyright 2022 The Noto Project Authors (https://github.com/notofonts/symbols)

BIN
assets/sounds/bikestart.ogg Normal file

Binary file not shown.

View file

@ -12,6 +12,7 @@ const ASSET_BGM: &str = "external/Ben Prunty - FTL - 12 Void (Explore).mp3";
const ASSET_THRUSTER: &str = "sounds/thruster.ogg";
const ASSET_ROCKET: &str = "sounds/rocket.ogg";
const ASSET_WAKEUP: &str = "sounds/wakeup.ogg";
const ASSET_BIKESTART: &str = "sounds/bikestart.ogg";
pub struct AudioPlugin;
impl Plugin for AudioPlugin {
@ -48,6 +49,7 @@ pub enum Sfx {
#[derive(Resource)] pub struct SoundIncomingMessage(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundPing(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundConnect(Handle<AudioSource>);
#[derive(Resource)] pub struct SoundBikeStart(Handle<AudioSource>);
pub fn setup(
mut commands: Commands,
@ -111,6 +113,7 @@ pub fn setup(
commands.insert_resource(SoundIncomingMessage(asset_server.load(ASSET_INCOMING_MESSAGE)));
commands.insert_resource(SoundPing(asset_server.load(ASSET_PING)));
commands.insert_resource(SoundConnect(asset_server.load(ASSET_CONNECT)));
commands.insert_resource(SoundBikeStart(asset_server.load(ASSET_BIKESTART)));
}
pub fn toggle_bgm(
@ -140,6 +143,7 @@ pub fn play_sfx(
sound_incoming_message: Res<SoundIncomingMessage>,
sound_ping: Res<SoundPing>,
sound_connect: Res<SoundConnect>,
sound_bikestart: Res<SoundBikeStart>,
) {
if settings.mute_sfx && !events_sfx.is_empty() {
events_sfx.clear();
@ -156,7 +160,7 @@ pub fn play_sfx(
Sfx::IncomingChatMessage => sound_incoming_message.0.clone(),
Sfx::Ping => sound_ping.0.clone(),
Sfx::Connect => sound_connect.0.clone(),
Sfx::EnterVehicle => sound_switch.0.clone(),
Sfx::EnterVehicle => sound_bikestart.0.clone(),
Sfx::None => sound_ping.0.clone(),
},
settings: PlaybackSettings::DESPAWN,