perfect victory handling (panic)
This commit is contained in:
parent
061e311cf6
commit
e68420b6ef
1 changed files with 5 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ pub struct EndGameEvent {
|
||||||
pub reason: EndGameReason,
|
pub reason: EndGameReason,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
pub enum EndGameReason {
|
pub enum EndGameReason {
|
||||||
Die,
|
Die,
|
||||||
Victory,
|
Victory,
|
||||||
|
|
@ -72,6 +72,10 @@ struct ResetWorldEvent;
|
||||||
fn on_end_game(event: On<EndGameEvent>, mut commands: Commands) {
|
fn on_end_game(event: On<EndGameEvent>, mut commands: Commands) {
|
||||||
let reason = event.reason;
|
let reason = event.reason;
|
||||||
println!("end game reason {:?}", reason);
|
println!("end game reason {:?}", reason);
|
||||||
|
|
||||||
|
if reason == EndGameReason::Victory {
|
||||||
|
panic!("You win! But you panic still");
|
||||||
|
}
|
||||||
commands.trigger(ResetWorldEvent);
|
commands.trigger(ResetWorldEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue