use bevy::prelude::*;

use crate::resources::AppState;

use super::gameover::GameOver;

#[derive(Clone, Copy, Debug)]
pub struct GameOverPlugin;

impl Plugin for GameOverPlugin {

    fn build(&self, app: &mut App) {
        app
            .add_systems(
                OnEnter(AppState::GameOver),
                GameOver::load,
            )
            .add_systems(
                OnExit(AppState::GameOver),
                GameOver::unload,
            )
            .add_systems(
                Update,
                GameOver::key_events.run_if(in_state(AppState::GameOver)),
            )
        ;
    }
}
