38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
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::<MatchState>
|
|
.and_then(resource_exists::<MatchConfig>)
|
|
.and_then(|match_config: Res<MatchConfig>| {
|
|
if let MatchRules::Stock { .. } = match_config.rules {
|
|
true
|
|
} else {
|
|
false
|
|
}
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|