sound effects of reloading

This commit is contained in:
2025-04-02 02:22:12 +08:00
parent 01f8128e5f
commit f967b1b0da
6 changed files with 13 additions and 2 deletions

View File

@@ -133,7 +133,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.insert_resource(HeadsImages { heads });
}
fn reload(mut active: ResMut<ActiveHeads>, time: Res<Time>) {
fn reload(mut commands: Commands, mut active: ResMut<ActiveHeads>, time: Res<Time>) {
if !active.reloading() {
return;
}
@@ -144,6 +144,7 @@ fn reload(mut active: ResMut<ActiveHeads>, time: Res<Time>) {
};
if !head.has_ammo() && (head.last_use + head.reload_duration <= time.elapsed_secs()) {
commands.trigger(PlaySound::Reloaded);
head.ammo = head.ammo_max;
}
}