perfect victory handling (panic)

This commit is contained in:
Crizomb 2026-01-08 23:49:41 +01:00
parent 061e311cf6
commit e68420b6ef

View file

@ -10,7 +10,7 @@ pub struct EndGameEvent {
pub reason: EndGameReason,
}
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EndGameReason {
Die,
Victory,
@ -72,6 +72,10 @@ struct ResetWorldEvent;
fn on_end_game(event: On<EndGameEvent>, mut commands: Commands) {
let reason = event.reason;
println!("end game reason {:?}", reason);
if reason == EndGameReason::Victory {
panic!("You win! But you panic still");
}
commands.trigger(ResetWorldEvent);
}