jet engine sound
closes HEZ-32
This commit is contained in:
BIN
assets/sfx/abilities/jet.ogg
Normal file
BIN
assets/sfx/abilities/jet.ogg
Normal file
Binary file not shown.
@@ -34,6 +34,8 @@ pub struct AudioAssets {
|
|||||||
pub throw: Handle<AudioSource>,
|
pub throw: Handle<AudioSource>,
|
||||||
#[asset(path = "sfx/abilities/throw-explosion.ogg")]
|
#[asset(path = "sfx/abilities/throw-explosion.ogg")]
|
||||||
pub throw_explosion: Handle<AudioSource>,
|
pub throw_explosion: Handle<AudioSource>,
|
||||||
|
#[asset(path = "sfx/abilities/jet.ogg")]
|
||||||
|
pub jet: Handle<AudioSource>,
|
||||||
|
|
||||||
#[asset(path = "sfx/ui/backpack_open.ogg")]
|
#[asset(path = "sfx/ui/backpack_open.ogg")]
|
||||||
pub backpack_open: Handle<AudioSource>,
|
pub backpack_open: Handle<AudioSource>,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::{
|
|||||||
heads::HeadChanged,
|
heads::HeadChanged,
|
||||||
heads_database::{HeadControls, HeadsDatabase},
|
heads_database::{HeadControls, HeadsDatabase},
|
||||||
hitpoints::Hitpoints,
|
hitpoints::Hitpoints,
|
||||||
loading_assets::GameAssets,
|
loading_assets::{AudioAssets, GameAssets},
|
||||||
physics_layers::GameLayer,
|
physics_layers::GameLayer,
|
||||||
sounds::PlaySound,
|
sounds::PlaySound,
|
||||||
tb_entities::SpawnPoint,
|
tb_entities::SpawnPoint,
|
||||||
@@ -203,6 +203,7 @@ fn on_update_head(
|
|||||||
head: Query<Entity, With<PlayerHeadMesh>>,
|
head: Query<Entity, With<PlayerHeadMesh>>,
|
||||||
mut player_head: Query<&mut ActiveHead, With<Player>>,
|
mut player_head: Query<&mut ActiveHead, With<Player>>,
|
||||||
head_db: Res<HeadsDatabase>,
|
head_db: Res<HeadsDatabase>,
|
||||||
|
audio_assets: Res<AudioAssets>,
|
||||||
) {
|
) {
|
||||||
let Ok(head) = head.get_single() else {
|
let Ok(head) = head.get_single() else {
|
||||||
return;
|
return;
|
||||||
@@ -218,6 +219,7 @@ fn on_update_head(
|
|||||||
|
|
||||||
commands.trigger(PlaySound::Head(head_str.to_string()));
|
commands.trigger(PlaySound::Head(head_str.to_string()));
|
||||||
|
|
||||||
|
//TODO: load from dynamic asset collection? or keep lazy?
|
||||||
let mesh = asset_server
|
let mesh = asset_server
|
||||||
.load(GltfAssetLabel::Scene(0).from_asset(format!("models/heads/{}.glb", head_str)));
|
.load(GltfAssetLabel::Scene(0).from_asset(format!("models/heads/{}.glb", head_str)));
|
||||||
|
|
||||||
@@ -230,6 +232,14 @@ fn on_update_head(
|
|||||||
|
|
||||||
commands
|
commands
|
||||||
.entity(head)
|
.entity(head)
|
||||||
.with_child((Transform::from_xyz(0., -1., 0.), SceneRoot(mesh)));
|
.with_child((Transform::from_xyz(0., -1., 0.), SceneRoot(mesh)))
|
||||||
|
.with_child((
|
||||||
|
Name::new("sfx"),
|
||||||
|
AudioPlayer::new(audio_assets.jet.clone()),
|
||||||
|
PlaybackSettings {
|
||||||
|
mode: bevy::audio::PlaybackMode::Loop,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user