Skip to content

Commit

Permalink
Run a one-shot system upon completion of Tween or Delay (#111)
Browse files Browse the repository at this point in the history
Co-authored-by: Peepo-Juice <[email protected]>
  • Loading branch information
Peepo-Juice and houssein-khafaja authored May 3, 2024
1 parent e97c200 commit 2357672
Show file tree
Hide file tree
Showing 2 changed files with 200 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn component_animator_system<T: Component>(
time: Res<Time>,
mut query: Query<(Entity, &mut T, &mut Animator<T>)>,
events: ResMut<Events<TweenCompleted>>,
mut commands: Commands,
) {
let mut events: Mut<Events<TweenCompleted>> = events.into();
for (entity, target, mut animator) in query.iter_mut() {
Expand All @@ -99,6 +100,7 @@ pub fn component_animator_system<T: Component>(
&mut target,
entity,
&mut events,
&mut commands,
);
}
}
Expand All @@ -116,6 +118,7 @@ pub fn asset_animator_system<T: Asset>(
mut assets: ResMut<Assets<T>>,
mut query: Query<(Entity, &Handle<T>, &mut AssetAnimator<T>)>,
events: ResMut<Events<TweenCompleted>>,
mut commands: Commands,
) {
let mut events: Mut<Events<TweenCompleted>> = events.into();
let mut target = AssetTarget::new(assets.reborrow());
Expand All @@ -131,6 +134,7 @@ pub fn asset_animator_system<T: Asset>(
&mut target,
entity,
&mut events,
&mut commands,
);
}
}
Expand Down
Loading

0 comments on commit 2357672

Please sign in to comment.