-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor, enable possible dynamic level loading (later)
- Loading branch information
Showing
9 changed files
with
66 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::screens::Screen; | ||
|
||
#[derive(SubStates, Clone, PartialEq, Eq, Hash, Debug, Default)] | ||
#[source(Screen = Screen::InGame)] | ||
pub enum Game { | ||
/// Player has successfully completed the level. | ||
Complete, | ||
/// Player has failed the level, menu shows with offer to retry or quit. | ||
Failed, | ||
/// Takes care of loading resources for the level to come, and providing hints to the player. | ||
#[default] | ||
Intro, | ||
/// Player has hit the pause key, pause menu shows. | ||
Paused, | ||
/// Active gameplay. | ||
Playing, | ||
} | ||
|
||
pub fn plugin(app: &mut App) { | ||
app.init_state::<Game>(); | ||
app.enable_state_scoped_entities::<Game>(); | ||
|
||
app.add_systems(OnEnter(Game::Intro), init); | ||
} | ||
|
||
fn init(mut next_state: ResMut<NextState<Game>>) { | ||
// TODO: later, we can use this state for intro screens and/or resource loading | ||
next_state.set(Game::Playing); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters