cash heal sound

This commit is contained in:
2025-04-07 12:58:27 +02:00
parent ddbf14be9b
commit a976072ebd
4 changed files with 12 additions and 1 deletions

BIN
assets/sfx/ui/cash_heal.ogg Normal file

Binary file not shown.

View File

@@ -1,4 +1,7 @@
use crate::{abilities::TriggerCashHeal, cash::CashResource, hitpoints::Hitpoints, player::Player};
use crate::{
abilities::TriggerCashHeal, cash::CashResource, hitpoints::Hitpoints, player::Player,
sounds::PlaySound,
};
use bevy::prelude::*;
pub fn plugin(app: &mut App) {
@@ -7,6 +10,7 @@ pub fn plugin(app: &mut App) {
fn on_heal_trigger(
_trigger: Trigger<TriggerCashHeal>,
mut cmds: Commands,
mut cash: ResMut<CashResource>,
mut query: Query<&mut Hitpoints, With<Player>>,
) {
@@ -27,4 +31,6 @@ fn on_heal_trigger(
hp.set_health(100);
cash.cash = cash.cash.saturating_sub(cost);
cmds.trigger(PlaySound::CashHeal);
}

View File

@@ -24,6 +24,9 @@ pub struct AudioAssets {
#[asset(path = "sfx/ui/reloaded.ogg")]
pub reloaded: Handle<AudioSource>,
#[asset(path = "sfx/ui/cash_heal.ogg")]
pub cash_heal: Handle<AudioSource>,
#[asset(path = "sfx/abilities/throw.ogg")]
pub throw: Handle<AudioSource>,
#[asset(path = "sfx/abilities/throw-explosion.ogg")]

View File

@@ -13,6 +13,7 @@ pub enum PlaySound {
Selection,
Invalid,
Reloaded,
CashHeal,
Backpack { open: bool },
Head(String),
}
@@ -48,6 +49,7 @@ fn spawn_sounds(
PlaySound::ThrowHit => assets.throw_explosion.clone(),
PlaySound::Reloaded => assets.reloaded.clone(),
PlaySound::Invalid => assets.invalid.clone(),
PlaySound::CashHeal => assets.cash_heal.clone(),
PlaySound::Backpack { open } => {
if *open {
assets.backpack_open.clone()