add game_over

This commit is contained in:
Jim 2025-09-01 22:05:18 -04:00
parent 1ecd054a31
commit e9379a6a94
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
5 changed files with 57 additions and 23 deletions

View file

@ -73,13 +73,14 @@ pub enum AppState {
Game,
}
#[derive(Debug, Clone, Eq, PartialEq, Hash, SubStates, Default)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, SubStates, Default)]
#[source(AppState = AppState::Game)]
pub enum GameState {
Loading,
#[default]
Running,
Paused,
GameOver,
}
/// this is what you should set to change the state. do not read this for scheduling
@ -117,7 +118,9 @@ impl ComputedStates for Phase {
fn compute(sources: Self::SourceStates) -> Option<Self> {
match sources {
(_, GameState::Loading, _) | (_, GameState::Paused, _) => None,
(_, GameState::Loading, _)
| (_, GameState::Paused, _)
| (_, GameState::GameOver, _) => None,
(_, _, CoreState::Dead) | (_, _, CoreState::Unplaced) => None,
(BasePhaseState::Execute { .. }, GameState::Running, CoreState::Placed) => {
Some(Self::Execute)