better example

This commit is contained in:
DasLixou 2024-08-21 15:32:37 +02:00
parent 4d9c451de8
commit 3e14cc06bf
1 changed files with 14 additions and 1 deletions

View File

@ -1,7 +1,7 @@
use bevy::prelude::*;
use blenvy::{BlenvyPlugin, BlueprintInfo, GameWorldTag, HideUntilReady, SpawnBlueprint};
#[derive(Component, Reflect)]
#[derive(Component, Reflect, Debug)]
#[reflect(Component)]
pub struct TupleRelations(Entity); // TODO: Serialization on blender side currently is broken
@ -21,6 +21,7 @@ fn main() {
.register_type::<TupleRelations>()
.register_type::<BigRelations>()
.add_systems(Startup, setup_game)
.add_systems(Update, (print_names, print_tuple_relations))
.run();
}
@ -33,3 +34,15 @@ fn setup_game(mut commands: Commands) {
GameWorldTag,
));
}
fn print_names(query: Query<(Entity, &Name), Added<Name>>) {
for (entity, name) in &query {
info!("[EXAMPLE] {name} is {entity}");
}
}
fn print_tuple_relations(query: Query<(&Name, &TupleRelations), Added<TupleRelations>>) {
for (name, r) in &query {
info!("[EXAMPLE] {name} has the relation {r:?}")
}
}