add sound effects: wake up sound, bgm (not provided with the source)
This commit is contained in:
parent
9ceede543e
commit
c003193723
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
target
|
target
|
||||||
|
assets/raw
|
||||||
|
assets/restricted
|
||||||
|
|
BIN
assets/sounds/wakeup.ogg
Normal file
BIN
assets/sounds/wakeup.ogg
Normal file
Binary file not shown.
21
src/main.rs
21
src/main.rs
|
@ -40,6 +40,10 @@ const CUBEMAPS: &[(&str, CompressedImageFormats)] = &[
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[derive(Resource)]
|
||||||
|
struct SoundInhale(Handle<AudioSource>);
|
||||||
|
|
||||||
|
|
||||||
fn setup(
|
fn setup(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
|
@ -51,6 +55,23 @@ fn setup(
|
||||||
window.cursor.visible = false;
|
window.cursor.visible = false;
|
||||||
window.mode = WindowMode::Fullscreen;
|
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
|
// camera
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera3dBundle {
|
Camera3dBundle {
|
||||||
|
|
Loading…
Reference in a new issue