sound effects of reloading
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user