add sound effects: wake up sound, bgm (not provided with the source)

This commit is contained in:
yuni 2024-03-16 20:27:10 +01:00
parent 9ceede543e
commit c003193723
3 changed files with 23 additions and 0 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
target
assets/raw
assets/restricted

BIN
assets/sounds/wakeup.ogg Normal file

Binary file not shown.

View file

@ -40,6 +40,10 @@ const CUBEMAPS: &[(&str, CompressedImageFormats)] = &[
),
];
#[derive(Resource)]
struct SoundInhale(Handle<AudioSource>);
fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
@ -51,6 +55,23 @@ fn setup(
window.cursor.visible = false;
window.mode = WindowMode::Fullscreen;
}
// Sound
let inhale_sound = asset_server.load("sounds/wakeup.ogg");
let res_inhale_sound = SoundInhale(inhale_sound);
//commands.insert_resource(res_inhale_sound);
commands.spawn(AudioBundle {
source: res_inhale_sound.0.clone(),
// auto-despawn the entity when playback finishes
settings: PlaybackSettings::DESPAWN,
});
commands.spawn(AudioBundle {
source: asset_server.load("restricted/FTL - Faster Than Light (2012) OST - 12 - Void (Explore)-edQw2yYXQJM.ogg"),
..default()
});
// camera
commands.spawn((
Camera3dBundle {