gate sound
volume down on music
This commit is contained in:
BIN
assets/sfx/effects/gate.ogg
Normal file
BIN
assets/sfx/effects/gate.ogg
Normal file
Binary file not shown.
BIN
assets/sfx/effects/key_collect.ogg
Normal file
BIN
assets/sfx/effects/key_collect.ogg
Normal file
Binary file not shown.
13
src/gates.rs
13
src/gates.rs
@@ -17,14 +17,27 @@ pub fn plugin(app: &mut App) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update(
|
fn update(
|
||||||
|
mut commands: Commands,
|
||||||
keyboard: Res<ButtonInput<KeyCode>>,
|
keyboard: Res<ButtonInput<KeyCode>>,
|
||||||
mut state: ResMut<GatesState>,
|
mut state: ResMut<GatesState>,
|
||||||
mut names_entities: Query<(&NamedEntity, &mut Transform)>,
|
mut names_entities: Query<(&NamedEntity, &mut Transform)>,
|
||||||
|
asset_server: Res<AssetServer>,
|
||||||
) {
|
) {
|
||||||
if keyboard.just_pressed(KeyCode::Digit1) {
|
if keyboard.just_pressed(KeyCode::Digit1) {
|
||||||
if matches!(*state, GatesState::Init) {
|
if matches!(*state, GatesState::Init) {
|
||||||
*state = GatesState::GateOpen1;
|
*state = GatesState::GateOpen1;
|
||||||
|
|
||||||
|
//TODO: put into a sound effects system
|
||||||
|
commands.spawn((
|
||||||
|
AudioPlayer::new(asset_server.load("sfx/effects/gate.ogg")),
|
||||||
|
PlaybackSettings::DESPAWN,
|
||||||
|
));
|
||||||
|
//TODO: put into actual key collect once we have that
|
||||||
|
commands.spawn((
|
||||||
|
AudioPlayer::new(asset_server.load("sfx/effects/key_collect.ogg")),
|
||||||
|
PlaybackSettings::DESPAWN,
|
||||||
|
));
|
||||||
|
|
||||||
let fences: HashMap<_, _> = vec![
|
let fences: HashMap<_, _> = vec![
|
||||||
("fence_01", Quat::from_rotation_y(PI / -2.)),
|
("fence_01", Quat::from_rotation_y(PI / -2.)),
|
||||||
("fence_02", Quat::from_rotation_y(PI / 2.)),
|
("fence_02", Quat::from_rotation_y(PI / 2.)),
|
||||||
|
|||||||
11
src/main.rs
11
src/main.rs
@@ -9,6 +9,8 @@ mod tb_entities;
|
|||||||
|
|
||||||
use avian3d::PhysicsPlugins;
|
use avian3d::PhysicsPlugins;
|
||||||
use avian3d::prelude::*;
|
use avian3d::prelude::*;
|
||||||
|
use bevy::audio::PlaybackMode;
|
||||||
|
use bevy::audio::Volume;
|
||||||
use bevy::core_pipeline::tonemapping::Tonemapping;
|
use bevy::core_pipeline::tonemapping::Tonemapping;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::render::view::ColorGrading;
|
use bevy::render::view::ColorGrading;
|
||||||
@@ -133,7 +135,14 @@ fn spawn_box(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn music(asset_server: Res<AssetServer>, mut commands: Commands) {
|
fn music(asset_server: Res<AssetServer>, mut commands: Commands) {
|
||||||
commands.spawn(AudioPlayer::new(asset_server.load("sfx/music/02.ogg")));
|
commands.spawn((
|
||||||
|
AudioPlayer::new(asset_server.load("sfx/music/02.ogg")),
|
||||||
|
PlaybackSettings {
|
||||||
|
mode: PlaybackMode::Loop,
|
||||||
|
volume: Volume::new(0.2),
|
||||||
|
..default()
|
||||||
|
},
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_trenchbroom_config(server: Res<TrenchBroomServer>) {
|
fn write_trenchbroom_config(server: Res<TrenchBroomServer>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user