hit sounds and general sound effects sys

This commit is contained in:
2025-03-16 20:37:13 +01:00
parent 4fdd15d765
commit 7241f30094
10 changed files with 68 additions and 35 deletions

View File

@@ -1,5 +1,7 @@
use bevy::prelude::*;
use crate::sounds::PlaySound;
#[derive(Component, Reflect, Default)]
#[reflect(Component)]
#[require(Transform)]
@@ -28,9 +30,8 @@ fn on_collect(
_trigger: Trigger<CashCollectEvent>,
mut commands: Commands,
mut cash: ResMut<CashResource>,
asset_server: Res<AssetServer>,
) {
commands.spawn(AudioPlayer::new(asset_server.load("sfx/effects/cash.ogg")));
commands.trigger(PlaySound::CashCollect);
cash.cash += 100;
}