single global observers root node (#25)
plus auto name observer macro `global_observer`
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
use super::TriggerThrow;
|
||||
use crate::{
|
||||
GameState, billboards::Billboard, hitpoints::Hit, loading_assets::GameAssets,
|
||||
physics_layers::GameLayer, sounds::PlaySound, utils::sprite_3d_animation::AnimationTimer,
|
||||
GameState,
|
||||
billboards::Billboard,
|
||||
hitpoints::Hit,
|
||||
loading_assets::GameAssets,
|
||||
physics_layers::GameLayer,
|
||||
sounds::PlaySound,
|
||||
utils::{global_observer, sprite_3d_animation::AnimationTimer},
|
||||
};
|
||||
use avian3d::prelude::*;
|
||||
use bevy::{pbr::NotShadowCaster, prelude::*};
|
||||
@@ -35,8 +40,9 @@ pub fn plugin(app: &mut App) {
|
||||
app.add_systems(OnEnter(GameState::Playing), setup);
|
||||
app.add_systems(Update, shot_collision.run_if(in_state(GameState::Playing)));
|
||||
app.add_systems(FixedUpdate, update_auto_rotation);
|
||||
app.add_observer(on_trigger_state);
|
||||
app.add_observer(on_explosion);
|
||||
|
||||
global_observer!(app, on_trigger_thrown);
|
||||
global_observer!(app, on_explosion);
|
||||
}
|
||||
|
||||
fn on_explosion(
|
||||
@@ -75,7 +81,7 @@ fn setup(mut commands: Commands, assets: Res<GameAssets>, mut sprite_params: Spr
|
||||
});
|
||||
}
|
||||
|
||||
fn on_trigger_state(
|
||||
fn on_trigger_thrown(
|
||||
trigger: Trigger<TriggerThrow>,
|
||||
mut commands: Commands,
|
||||
query_transform: Query<&Transform>,
|
||||
|
||||
Reference in New Issue
Block a user