mirror of
https://github.com/kristoferssolo/maze-ascension.git
synced 2026-01-13 03:56:08 +00:00
30 lines
773 B
Rust
30 lines
773 B
Rust
//! The screen state for the main gameplay.
|
|
|
|
use crate::player::spawn_player_command;
|
|
use crate::screens::Screen;
|
|
use crate::{hint::spawn_hint_command, maze::spawn_level_command};
|
|
|
|
use bevy::{input::common_conditions::input_just_pressed, prelude::*};
|
|
|
|
pub(super) fn plugin(app: &mut App) {
|
|
app.add_systems(
|
|
OnEnter(Screen::Gameplay),
|
|
(
|
|
spawn_level_command,
|
|
spawn_player_command,
|
|
spawn_hint_command,
|
|
)
|
|
.chain(),
|
|
);
|
|
|
|
app.add_systems(
|
|
Update,
|
|
return_to_title_screen
|
|
.run_if(in_state(Screen::Gameplay).and(input_just_pressed(KeyCode::Escape))),
|
|
);
|
|
}
|
|
|
|
fn return_to_title_screen(mut next_screen: ResMut<NextState<Screen>>) {
|
|
next_screen.set(Screen::Title);
|
|
}
|