Commit 3c26e8e 1 parent 31331dc commit 3c26e8e Copy full SHA for 3c26e8e
File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use pyri_state::extra::entity_scope::StateScope;
5
5
use pyri_state:: prelude:: * ;
6
6
7
7
use crate :: core:: pause:: Pause ;
8
+ use crate :: game:: audio:: music:: MusicHandle ;
8
9
use crate :: screen:: fade_out;
9
10
use crate :: screen:: playing:: PlayingAssets ;
10
11
use crate :: screen:: playing:: PlayingMenu ;
@@ -109,9 +110,15 @@ fn continue_button(mut entity: EntityWorldMut) {
109
110
fn restart_button ( mut entity : EntityWorldMut ) {
110
111
entity. add ( widget:: menu_button ( "Restart" ) ) . insert ( (
111
112
On :: < Pointer < Click > > :: run (
112
- |mut commands : Commands , audio : Res < Audio > , assets : Res < PlayingAssets > | {
113
- audio. play ( assets. sfx_restart . clone ( ) ) . with_volume ( 0.7 ) ;
113
+ |mut commands : Commands ,
114
+ audio : Res < Audio > ,
115
+ assets : Res < PlayingAssets > ,
116
+ music_handle : Res < MusicHandle > ,
117
+ mut audio_instances : ResMut < Assets < AudioInstance > > | {
114
118
commands. spawn_with ( fade_out ( Screen :: Playing ) ) ;
119
+ audio. play ( assets. sfx_restart . clone ( ) ) . with_volume ( 0.7 ) ;
120
+ let music = r ! ( audio_instances. get_mut( & music_handle. 0 ) ) ;
121
+ music. seek_to ( 0.0 ) ;
115
122
} ,
116
123
) ,
117
124
Style {
You can’t perform that action at this time.
0 commit comments