Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Jul 22, 2023
1 parent dcd082a commit 731e9a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions crates/audio/src/music.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bevy::{asset::LoadState, prelude::*};
use bevy::{asset::LoadState, audio::Volume, prelude::*};
use de_conf::Configuration;
use de_core::state::AppState;
use iyes_progress::prelude::*;
Expand All @@ -12,7 +12,7 @@ impl Plugin for MusicPlugin {
Update,
load.track_progress().run_if(in_state(AppState::AppLoading)),
)
.add_systems(Update, start.in_schedule(OnExit(AppState::AppLoading)));
.add_systems(OnExit(AppState::AppLoading), start);
}
}

Expand All @@ -31,12 +31,14 @@ fn load(server: Res<AssetServer>, tracks: Res<Tracks>) -> Progress {
}
}

fn start(audio: Res<Audio>, tracks: Res<Tracks>, config: Res<Configuration>) {
fn start(mut commands: Commands, tracks: Res<Tracks>, config: Res<Configuration>) {
if !config.audio().music_enabled() {
return;
}
audio.play_with_settings(
tracks.0.clone(),
PlaybackSettings::LOOP.with_volume(config.audio().music_volume()),
);

let volume = Volume::new_relative(config.audio().music_volume());
commands.spawn(AudioBundle {
source: tracks.0.clone(),
settings: PlaybackSettings::LOOP.with_volume(volume),
});
}
2 changes: 1 addition & 1 deletion crates/camera/src/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) struct DistancePlugin;
impl Plugin for DistancePlugin {
fn build(&self, app: &mut App) {
app.add_systems(
PostUPdate,
PostUpdate,
(
init::<MovableSolid>.run_if(in_state(AppState::InGame)),
init::<StaticSolid>.run_if(in_state(AppState::InGame)),
Expand Down
3 changes: 2 additions & 1 deletion crates/menu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use bevy::{app::PluginGroupBuilder, prelude::*};
use create::CreateGamePlugin;
use de_core::{
gresult::GameResult,
nested_state,
state::AppState,
transition::{DeStateTransition, StateWithSet},
};
Expand All @@ -28,7 +29,7 @@ pub struct MenuPluginGroup;
impl PluginGroup for MenuPluginGroup {
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(MenuSetupPlugin)
.add(MenuStatePlugin)
.add(MenuPlugin)
.add(MainMenuPlugin)
.add(MapSelectionPlugin)
Expand Down

0 comments on commit 731e9a9

Please sign in to comment.