more sound effects
This commit is contained in:
Binary file not shown.
BIN
assets/sfx/ui/backpack_close.ogg
Normal file
BIN
assets/sfx/ui/backpack_close.ogg
Normal file
Binary file not shown.
BIN
assets/sfx/ui/backpack_open.ogg
Normal file
BIN
assets/sfx/ui/backpack_open.ogg
Normal file
Binary file not shown.
BIN
assets/sfx/ui/selection.ogg
Normal file
BIN
assets/sfx/ui/selection.ogg
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
use super::{BackbackSwapEvent, Backpack, BackpackHead};
|
use super::{BackbackSwapEvent, Backpack, BackpackHead};
|
||||||
use crate::{GameState, heads_ui::HeadsImages, loading_assets::UIAssets};
|
use crate::{GameState, heads_ui::HeadsImages, loading_assets::UIAssets, sounds::PlaySound};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
static HEAD_SLOTS: usize = 5;
|
static HEAD_SLOTS: usize = 5;
|
||||||
@@ -270,6 +270,7 @@ fn swap_head_inputs(
|
|||||||
let action = *trigger.event();
|
let action = *trigger.event();
|
||||||
if action == BackpackAction::OpenClose {
|
if action == BackpackAction::OpenClose {
|
||||||
state.open = !state.open;
|
state.open = !state.open;
|
||||||
|
commands.trigger(PlaySound::Backpack { open: state.open });
|
||||||
}
|
}
|
||||||
|
|
||||||
if !state.open {
|
if !state.open {
|
||||||
@@ -290,6 +291,7 @@ fn swap_head_inputs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if changed {
|
if changed {
|
||||||
|
commands.trigger(PlaySound::Selection);
|
||||||
sync(&backpack, &mut state);
|
sync(&backpack, &mut state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use crate::{
|
|||||||
backpack::{BackbackSwapEvent, Backpack, BackpackHead},
|
backpack::{BackbackSwapEvent, Backpack, BackpackHead},
|
||||||
loading_assets::UIAssets,
|
loading_assets::UIAssets,
|
||||||
player::head_id_to_str,
|
player::head_id_to_str,
|
||||||
|
sounds::PlaySound,
|
||||||
};
|
};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
@@ -204,6 +205,7 @@ fn on_select_active_head(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commands.trigger(PlaySound::Selection);
|
||||||
commands.trigger(HeadChanged(res.heads[res.current_slot].unwrap()));
|
commands.trigger(HeadChanged(res.heads[res.current_slot].unwrap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,14 @@ pub struct AudioAssets {
|
|||||||
pub gate: Handle<AudioSource>,
|
pub gate: Handle<AudioSource>,
|
||||||
#[asset(path = "sfx/effects/cash.ogg")]
|
#[asset(path = "sfx/effects/cash.ogg")]
|
||||||
pub cash: Handle<AudioSource>,
|
pub cash: Handle<AudioSource>,
|
||||||
|
#[asset(path = "sfx/ui/selection.ogg")]
|
||||||
|
pub selection: Handle<AudioSource>,
|
||||||
|
|
||||||
|
#[asset(path = "sfx/ui/backpack_open.ogg")]
|
||||||
|
pub backpack_open: Handle<AudioSource>,
|
||||||
|
#[asset(path = "sfx/ui/backpack_close.ogg")]
|
||||||
|
pub backpack_close: Handle<AudioSource>,
|
||||||
|
|
||||||
#[asset(path = "sfx/hit", collection(typed))]
|
#[asset(path = "sfx/hit", collection(typed))]
|
||||||
pub hit: Vec<Handle<AudioSource>>,
|
pub hit: Vec<Handle<AudioSource>>,
|
||||||
#[asset(path = "sfx/heads", collection(mapped, typed))]
|
#[asset(path = "sfx/heads", collection(mapped, typed))]
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ fn music(assets: Res<AudioAssets>, mut commands: Commands) {
|
|||||||
AudioPlayer::new(assets.music.clone()),
|
AudioPlayer::new(assets.music.clone()),
|
||||||
PlaybackSettings {
|
PlaybackSettings {
|
||||||
mode: PlaybackMode::Loop,
|
mode: PlaybackMode::Loop,
|
||||||
volume: Volume::new(0.6),
|
volume: Volume::new(0.4),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
@@ -142,7 +142,7 @@ fn music(assets: Res<AudioAssets>, mut commands: Commands) {
|
|||||||
AudioPlayer::new(assets.ambient.clone()),
|
AudioPlayer::new(assets.ambient.clone()),
|
||||||
PlaybackSettings {
|
PlaybackSettings {
|
||||||
mode: PlaybackMode::Loop,
|
mode: PlaybackMode::Loop,
|
||||||
volume: Volume::new(1.),
|
volume: Volume::new(0.8),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ pub enum PlaySound {
|
|||||||
Gun,
|
Gun,
|
||||||
Gate,
|
Gate,
|
||||||
CashCollect,
|
CashCollect,
|
||||||
|
Selection,
|
||||||
|
Backpack { open: bool },
|
||||||
Head(String),
|
Head(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +39,14 @@ fn spawn_sounds(
|
|||||||
PlaySound::Gun => assets.gun.clone(),
|
PlaySound::Gun => assets.gun.clone(),
|
||||||
PlaySound::Gate => assets.gate.clone(),
|
PlaySound::Gate => assets.gate.clone(),
|
||||||
PlaySound::CashCollect => assets.cash.clone(),
|
PlaySound::CashCollect => assets.cash.clone(),
|
||||||
|
PlaySound::Selection => assets.selection.clone(),
|
||||||
|
PlaySound::Backpack { open } => {
|
||||||
|
if *open {
|
||||||
|
assets.backpack_open.clone()
|
||||||
|
} else {
|
||||||
|
assets.backpack_close.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
PlaySound::Head(name) => {
|
PlaySound::Head(name) => {
|
||||||
let filename = format!("{}.ogg", name);
|
let filename = format!("{}.ogg", name);
|
||||||
assets
|
assets
|
||||||
|
|||||||
Reference in New Issue
Block a user