From dcc40c9205e5f4cf484523f97eb12a561d7b2b22 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 9 Dec 2024 14:05:33 +0100 Subject: refactor(ecs): use phases for system ordering --- ecs/examples/optional_component.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'ecs/examples/optional_component.rs') diff --git a/ecs/examples/optional_component.rs b/ecs/examples/optional_component.rs index e47bf2e..bcc0c54 100644 --- a/ecs/examples/optional_component.rs +++ b/ecs/examples/optional_component.rs @@ -1,4 +1,4 @@ -use ecs::event::Event; +use ecs::phase::UPDATE as UPDATE_PHASE; use ecs::{Component, Query, World}; #[derive(Debug, Component)] @@ -48,16 +48,11 @@ fn pet_cats(query: Query<(CatName, PettingCapacity, Option)>) } } -#[derive(Debug)] -struct PettingTime; - -impl Event for PettingTime {} - fn main() { let mut world = World::new(); - world.register_system(PettingTime, pet_cats); + world.register_system(*UPDATE_PHASE, pet_cats); world.create_entity(( CatName { name: "Jasper".to_string() }, @@ -82,5 +77,5 @@ fn main() Aggressivity::Low, )); - world.emit(PettingTime); + world.step(); } -- cgit v1.2.3-18-g5258