|
|
|
@ -66,6 +66,7 @@ fn main() {
|
|
|
|
// Run if state changed: AudioPlayback
|
|
|
|
// Run if state changed: AudioPlayback
|
|
|
|
control_volume,
|
|
|
|
control_volume,
|
|
|
|
toggle_audio_state.run_if(input_just_pressed(KeyCode::KeyM)),
|
|
|
|
toggle_audio_state.run_if(input_just_pressed(KeyCode::KeyM)),
|
|
|
|
|
|
|
|
toggle_playback_state.run_if(input_just_pressed(KeyCode::Space)),
|
|
|
|
de_spawn_cells
|
|
|
|
de_spawn_cells
|
|
|
|
.run_if(not(is_ui_hovered))
|
|
|
|
.run_if(not(is_ui_hovered))
|
|
|
|
.run_if(not(is_panning))
|
|
|
|
.run_if(not(is_panning))
|
|
|
|
@ -997,6 +998,20 @@ fn toggle_audio_state(
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn toggle_playback_state(
|
|
|
|
|
|
|
|
mut next_state: ResMut<NextState<SimulationPlayback>>,
|
|
|
|
|
|
|
|
curr_state: Res<State<SimulationPlayback>>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
// Set next audio playback state
|
|
|
|
|
|
|
|
next_state.set(
|
|
|
|
|
|
|
|
match curr_state.get() {
|
|
|
|
|
|
|
|
SimulationPlayback::Run => SimulationPlayback::Pause,
|
|
|
|
|
|
|
|
SimulationPlayback::Step => SimulationPlayback::Pause,
|
|
|
|
|
|
|
|
SimulationPlayback::Pause => SimulationPlayback::Run,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn control_volume(
|
|
|
|
fn control_volume(
|
|
|
|
audio_state: Res<State<AudioPlayback>>,
|
|
|
|
audio_state: Res<State<AudioPlayback>>,
|
|
|
|
simulation_state: Res<State<SimulationPlayback>>,
|
|
|
|
simulation_state: Res<State<SimulationPlayback>>,
|
|
|
|
|