jet engine sound
closes HEZ-32
This commit is contained in:
@@ -34,6 +34,8 @@ pub struct AudioAssets {
|
||||
pub throw: Handle<AudioSource>,
|
||||
#[asset(path = "sfx/abilities/throw-explosion.ogg")]
|
||||
pub throw_explosion: Handle<AudioSource>,
|
||||
#[asset(path = "sfx/abilities/jet.ogg")]
|
||||
pub jet: Handle<AudioSource>,
|
||||
|
||||
#[asset(path = "sfx/ui/backpack_open.ogg")]
|
||||
pub backpack_open: Handle<AudioSource>,
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{
|
||||
heads::HeadChanged,
|
||||
heads_database::{HeadControls, HeadsDatabase},
|
||||
hitpoints::Hitpoints,
|
||||
loading_assets::GameAssets,
|
||||
loading_assets::{AudioAssets, GameAssets},
|
||||
physics_layers::GameLayer,
|
||||
sounds::PlaySound,
|
||||
tb_entities::SpawnPoint,
|
||||
@@ -203,6 +203,7 @@ fn on_update_head(
|
||||
head: Query<Entity, With<PlayerHeadMesh>>,
|
||||
mut player_head: Query<&mut ActiveHead, With<Player>>,
|
||||
head_db: Res<HeadsDatabase>,
|
||||
audio_assets: Res<AudioAssets>,
|
||||
) {
|
||||
let Ok(head) = head.get_single() else {
|
||||
return;
|
||||
@@ -218,6 +219,7 @@ fn on_update_head(
|
||||
|
||||
commands.trigger(PlaySound::Head(head_str.to_string()));
|
||||
|
||||
//TODO: load from dynamic asset collection? or keep lazy?
|
||||
let mesh = asset_server
|
||||
.load(GltfAssetLabel::Scene(0).from_asset(format!("models/heads/{}.glb", head_str)));
|
||||
|
||||
@@ -230,6 +232,14 @@ fn on_update_head(
|
||||
|
||||
commands
|
||||
.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