-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added map view and battle view game state.
- Loading branch information
StarArawn
authored and
StarArawn
committed
Apr 16, 2021
1 parent
10a74fa
commit 37d1f82
Showing
8 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,12 +1,28 @@ | ||
use bevy::prelude::*; | ||
|
||
#[derive(Clone, Eq, PartialEq, Debug, Hash)] | ||
pub enum GameState { | ||
Loading, | ||
Generating, | ||
Playing, | ||
MapView, | ||
BattleView, | ||
} | ||
|
||
impl Default for GameState { | ||
fn default() -> Self { | ||
GameState::Loading | ||
} | ||
} | ||
|
||
pub fn update_visibility_for_state( | ||
game_state: Res<State<GameState>>, | ||
mut query: Query<(&mut Visible, &mut Transform, &GameState)>, | ||
) { | ||
for (mut visible, mut transform, target_game_state) in query.iter_mut() { | ||
if game_state.current() == target_game_state { | ||
visible.is_visible = true; | ||
} else { | ||
visible.is_visible = false; | ||
} | ||
} | ||
} |
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
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