Skip to content

Commit

Permalink
Remove outdated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Trashtalk217 committed Aug 28, 2023
1 parent 47c75fc commit 1963e63
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions examples/ecs/one_shot_systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ use bevy::{
fn main() {
App::new()
.add_systems(Startup, (count_entities, setup))
// One shot systems are interchangeable with ordinarily scheduled systems.
.add_systems(PostUpdate, count_entities)
// One-shot systems can be used to build complex abstractions
// to match the needs of your design.
// Here, we model a very simple component-linked callback architecture.
.add_systems(Update, evaluate_callbacks)
.run();
}
Expand All @@ -38,9 +34,6 @@ struct Triggered;

fn setup(mut system_registry: ResMut<SystemRegistry>, mut commands: Commands) {
commands.spawn((
// The Callback component is defined in bevy_ecs,
// but wrapping this (or making your own customized variant) is easy.
// Just stored a boxed SystemLabel!
Callback(system_registry.register(button_pressed)),
Triggered,
));
Expand All @@ -62,10 +55,6 @@ fn slider_toggled() {
/// This could be done in an exclusive system rather than using `Commands` if preferred.
fn evaluate_callbacks(query: Query<&Callback, With<Triggered>>, mut commands: Commands) {
for callback in query.iter() {
// Because we don't have access to the type information of the callbacks
// we have to use the layer of indirection provided by system labels.
// Note that if we had registered multiple systems with the same label,
// they would all be evaluated here.
commands.run_system_by_id(callback.0);
}
}

0 comments on commit 1963e63

Please sign in to comment.