Newer
Older
use crate::query::{
play_animations, play_directional_animations, play_override_animation, play_simple_animation,
sync_child_animation,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)]
pub enum AnimationSystems {
TickAnimations,
SyncAnimations,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Event)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AnimationCompleted {
pub entity: Entity,
pub user_data: u128,
}
pub struct AnimationSystemsPlugin;
impl Plugin for AnimationSystemsPlugin {
fn build(&self, app: &mut App) {
app.add_event::<AnimationCompleted>();
app.configure_sets(
PostUpdate,
(AnimationSystems::TickAnimations.before(AnimationSystems::SyncAnimations),),
);
app.add_systems(
PostUpdate,
(
play_animations,
play_override_animation,
play_directional_animations,
play_simple_animation,
.in_set(AnimationSystems::SyncAnimations),
)
.add_systems(
PostUpdate,
sync_child_animation.in_set(AnimationSystems::SyncAnimations),
);