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