add sound effects

This commit is contained in:
Jim 2025-09-02 21:13:21 -04:00
parent 86f2345667
commit 587b902e79
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
39 changed files with 234 additions and 40 deletions

View file

@ -5,7 +5,7 @@
use avian3d::prelude::*;
use bevy::prelude::*;
use building::Building;
use combat::{GaveDamage, Health, Team};
use combat::{DeathAudio, GaveDamage, Health, Team};
use combat_damagers::ContactDamage;
use inhabitant::Inhabitant;
use resources::{Drops, Quantity};
@ -38,12 +38,14 @@ struct SimbertResources {
mesh: Handle<Mesh>,
mega_material: Handle<StandardMaterial>,
mega_scale: f32,
death_sound: Handle<AudioSource>,
}
fn init(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
assets: Res<AssetServer>,
) {
commands.insert_resource(SimbertResources {
material: materials.add(StandardMaterial {
@ -60,6 +62,7 @@ fn init(
..default()
}),
mega_scale: 1.3,
death_sound: assets.load("sounds/gasp3.ogg"),
});
}
fn spawn(
@ -93,6 +96,7 @@ fn spawn(
Mesh3d(res.mesh.clone()),
MeshMaterial3d(material),
MaxLinearSpeed(25.),
DeathAudio(res.death_sound.clone()),
Simbert,
drops,
transform,