single global observers root node (#25)

plus auto name observer macro `global_observer`
This commit is contained in:
extrawurst
2025-04-07 18:22:29 +02:00
committed by GitHub
parent 92da1587ba
commit ddc57ec1e8
17 changed files with 94 additions and 37 deletions

View File

@@ -1,5 +1,7 @@
use super::{BackbackSwapEvent, Backpack, UiHeadState};
use crate::{GameState, heads::HeadsImages, loading_assets::UIAssets, sounds::PlaySound};
use crate::{
GameState, global_observer, heads::HeadsImages, loading_assets::UIAssets, sounds::PlaySound,
};
use bevy::prelude::*;
static HEAD_SLOTS: usize = 5;
@@ -51,7 +53,7 @@ pub fn plugin(app: &mut App) {
.run_if(in_state(GameState::Playing)),
);
app.add_observer(swap_head_inputs);
global_observer!(app, swap_head_inputs);
}
fn setup(mut commands: Commands, assets: Res<UIAssets>) {