Skip to content

Commit

Permalink
Style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakru committed Jul 21, 2023
1 parent ba44da5 commit 8c8fb01
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions crates/audio/src/spatial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use bevy_kira_audio::{
prelude::{Audio as KAudio, AudioSource as KAudioSource},
AudioControl, AudioInstance,
};

use de_camera::CameraFocus;
use de_core::gamestate::GameState;

Expand Down Expand Up @@ -68,17 +67,16 @@ fn calculate_volume_and_pan(
(distance_attenuation as f64, pan as f64)
}

type UninitializedSound<'s> = (
Entity,
&'s Handle<KAudioSource>,
&'s GlobalTransform,
Option<&'s Volume>,
);

fn start(
mut commands: Commands,
starts: Query<
(
Entity,
&Handle<KAudioSource>,
&GlobalTransform,
Option<&Volume>,
),
(With<SpatialSound>, Without<Handle<AudioInstance>>),
>,
starts: Query<UninitializedSound, (With<SpatialSound>, Without<Handle<AudioInstance>>)>,
camera: Query<&GlobalTransform, With<Camera>>,
focus: Res<CameraFocus>,
audio: Res<KAudio>,
Expand All @@ -97,17 +95,16 @@ fn start(
}
}

type InitializedSound<'s> = (
Entity,
&'s Handle<AudioInstance>,
&'s GlobalTransform,
Option<&'s Volume>,
);

fn update_spatial(
mut commands: Commands,
spatial_audios: Query<
(
Entity,
&Handle<AudioInstance>,
&GlobalTransform,
Option<&Volume>,
),
With<SpatialSound>,
>,
spatial_audios: Query<InitializedSound, With<SpatialSound>>,
camera: Query<&GlobalTransform, With<Camera>>,
focus: Res<CameraFocus>,
mut audio_instances: ResMut<Assets<AudioInstance>>,
Expand Down

0 comments on commit 8c8fb01

Please sign in to comment.