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/extension.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'ecs/examples/extension.rs') diff --git a/ecs/examples/extension.rs b/ecs/examples/extension.rs index 2022b05..ddde32c 100644 --- a/ecs/examples/extension.rs +++ b/ecs/examples/extension.rs @@ -1,6 +1,6 @@ use ecs::actions::Actions; -use ecs::event::Event; use ecs::extension::{Collector as ExtensionCollector, Extension}; +use ecs::phase::UPDATE as UPDATE_PHASE; use ecs::{Component, Query, World}; #[derive(Debug, Component)] @@ -19,11 +19,6 @@ enum EvilnessLevel Medium, } -#[derive(Debug)] -struct Update; - -impl Event for Update {} - fn spawn_enemies( spawner_query: Query<(EnemySpawnSource, Position)>, enemies_query: Query<(EvilnessLevel,)>, @@ -57,7 +52,7 @@ impl Extension for EnemySpawningExtension { fn collect(self, mut collector: ExtensionCollector<'_>) { - collector.add_system(Update, spawn_enemies); + collector.add_system(*UPDATE_PHASE, spawn_enemies); collector.add_entity((Position { x: 187, y: 30 }, EnemySpawnSource)); } @@ -70,8 +65,6 @@ fn main() world.add_extension(EnemySpawningExtension); for _ in 0..7 { - world.emit(Update); - - world.perform_queued_actions(); + world.step(); } } -- cgit v1.2.3-18-g5258