summaryrefslogtreecommitdiff
path: root/ecs/examples/relationship.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/examples/relationship.rs')
-rw-r--r--ecs/examples/relationship.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/ecs/examples/relationship.rs b/ecs/examples/relationship.rs
index b607398..4e94151 100644
--- a/ecs/examples/relationship.rs
+++ b/ecs/examples/relationship.rs
@@ -1,6 +1,5 @@
-use ecs::pair::Pair;
+use ecs::pair::{Pair, Wildcard};
use ecs::phase::START as START_PHASE;
-use ecs::uid::Wildcard;
use ecs::{Component, Query, World};
#[derive(Component)]
@@ -23,10 +22,10 @@ struct Holding;
fn print_player_stats(player_query: Query<(&Player, &Health, Pair<Holding, Wildcard>)>)
{
- for (_, health, sword_relationship) in &player_query {
+ for (_, health, target_sword) in &player_query {
println!("Player health: {}", health.health);
- if let Some(sword_ent) = sword_relationship.get_target_entity() {
+ if let Some(sword_ent) = target_sword.get_target_ent() {
let sword = sword_ent
.get::<Sword>()
.expect("Sword entity is missing sword component");
@@ -47,7 +46,10 @@ fn main()
world.create_entity((
Player,
Health { health: 180 },
- Pair::new::<Holding>(sword_uid),
+ Pair::builder()
+ .relation::<Holding>()
+ .target_id(sword_uid)
+ .build(),
));
world.step();