seed reset on go
This commit is contained in:
+11
-5
@@ -1,6 +1,6 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
use crate::{camera::MainCamera, game_state::GameState};
|
use crate::{camera::MainCamera, game_state::GameState, world::RunSeed};
|
||||||
|
|
||||||
// To delete game over's components
|
// To delete game over's components
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
@@ -48,15 +48,21 @@ fn cleanup_game_over(mut commands: Commands, game_over: Query<Entity, With<GameO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn game_over_input(input: Res<ButtonInput<KeyCode>>, mut next_state: ResMut<NextState<GameState>>) {
|
// For debug bug same logic on collision (will be renamed)
|
||||||
|
fn game_over_input(
|
||||||
|
input: Res<ButtonInput<KeyCode>>,
|
||||||
|
mut run_seed: ResMut<RunSeed>,
|
||||||
|
mut next_state: ResMut<NextState<GameState>>,
|
||||||
|
) {
|
||||||
if input.just_pressed(KeyCode::KeyN) {
|
if input.just_pressed(KeyCode::KeyN) {
|
||||||
// TODO: Restart with completely reseting the game state (OnEnter maybe)
|
// New seed
|
||||||
|
run_seed.0 = rand::random::<u64>();
|
||||||
next_state.set(GameState::InGame);
|
next_state.set(GameState::InGame);
|
||||||
} else if input.just_pressed(KeyCode::KeyR) {
|
} else if input.just_pressed(KeyCode::KeyR) {
|
||||||
// TODO: restart with the same seed
|
// Same seed
|
||||||
next_state.set(GameState::InGame);
|
next_state.set(GameState::InGame);
|
||||||
} else if input.just_pressed(KeyCode::KeyT) {
|
} else if input.just_pressed(KeyCode::KeyT) {
|
||||||
// TODO: Clear all of the game asset (OnExit)
|
// Return to the Main Menu
|
||||||
next_state.set(GameState::MainMenu);
|
next_state.set(GameState::MainMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user