use bevy::prelude::*; use crate::{ AppState, match_loading::{MatchConfig, MatchRules}, match_runtime::MatchState, }; pub mod battle_ui; pub mod errors; pub mod fighter_info; pub mod stock_icon; #[derive(Default)] pub struct InGameUIPlugin; impl Plugin for InGameUIPlugin { fn build(&self, app: &mut App) { app.add_systems(OnEnter(AppState::InMatch), battle_ui::spawn_battle_ui) .add_systems(OnExit(AppState::InMatch), battle_ui::cleanup_battle_ui) .add_systems(PostUpdate, fighter_info::update_fighter_info_damage) .add_systems( PostUpdate, fighter_info::update_fighter_info_stocks.run_if( resource_exists:: .and_then(resource_exists::) .and_then(|match_config: Res| { if let MatchRules::Stock { .. } = match_config.rules { true } else { false } }), ), ); } }