add head-drop and collect sound
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
GameState, billboards::Billboard, global_observer, loading_assets::GameAssets, player::Player,
|
||||
squish_animation::SquishAnimation,
|
||||
sounds::PlaySound, squish_animation::SquishAnimation,
|
||||
};
|
||||
use avian3d::prelude::*;
|
||||
use bevy::prelude::*;
|
||||
@@ -28,6 +28,8 @@ fn on_head_drop(trigger: Trigger<HeadDrops>, mut commands: Commands, assets: Res
|
||||
let angle = rand::random::<f32>() * PI * 2.;
|
||||
let spawn_dir = Quat::from_rotation_y(angle) * Vec3::new(0.5, 0.6, 0.).normalize();
|
||||
|
||||
commands.trigger(PlaySound::HeadDrop);
|
||||
|
||||
commands
|
||||
.spawn((
|
||||
Name::new("headdrop"),
|
||||
@@ -64,7 +66,7 @@ fn collect_head(
|
||||
|
||||
let key = query_collectable.get(collectable).unwrap();
|
||||
|
||||
// commands.trigger(PlaySound::KeyCollect);
|
||||
commands.trigger(PlaySound::HeadCollect);
|
||||
commands.trigger(HeadCollected(key.0));
|
||||
commands.entity(collectable).despawn_recursive();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ pub struct AudioAssets {
|
||||
#[asset(path = "sfx/ui/backpack_close.ogg")]
|
||||
pub backpack_close: Handle<AudioSource>,
|
||||
|
||||
#[asset(path = "sfx/effects/head_collect.ogg")]
|
||||
pub head_collect: Handle<AudioSource>,
|
||||
#[asset(path = "sfx/effects/head_drop.ogg")]
|
||||
pub head_drop: Handle<AudioSource>,
|
||||
|
||||
#[asset(path = "sfx/hit", collection(typed))]
|
||||
pub hit: Vec<Handle<AudioSource>>,
|
||||
#[asset(path = "sfx/heads", collection(mapped, typed))]
|
||||
|
||||
@@ -10,6 +10,8 @@ pub enum PlaySound {
|
||||
ThrowHit,
|
||||
Gate,
|
||||
CashCollect,
|
||||
HeadCollect,
|
||||
HeadDrop,
|
||||
Selection,
|
||||
Invalid,
|
||||
Reloaded,
|
||||
@@ -52,6 +54,8 @@ fn on_spawn_sounds(
|
||||
PlaySound::Reloaded => assets.reloaded.clone(),
|
||||
PlaySound::Invalid => assets.invalid.clone(),
|
||||
PlaySound::CashHeal => assets.cash_heal.clone(),
|
||||
PlaySound::HeadDrop => assets.head_drop.clone(),
|
||||
PlaySound::HeadCollect => assets.head_collect.clone(),
|
||||
PlaySound::Backpack { open } => {
|
||||
if *open {
|
||||
assets.backpack_open.clone()
|
||||
|
||||
Reference in New Issue
Block a user