diff options
author | HampusM <hampus@hampusmat.com> | 2024-12-09 14:05:33 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-12-09 14:05:33 +0100 |
commit | dcc40c9205e5f4cf484523f97eb12a561d7b2b22 (patch) | |
tree | 2908b6ca3b2fa390a45b383b91edf7a72c42ef4b /ecs/examples/extension.rs | |
parent | 158e36bf6bfcbc2ed0ffc670788ed8c0abd3f282 (diff) |
refactor(ecs): use phases for system ordering
Diffstat (limited to 'ecs/examples/extension.rs')
-rw-r--r-- | ecs/examples/extension.rs | 13 |
1 files changed, 3 insertions, 10 deletions
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(); } } |