use bevy::prelude::*;
use crate::{
animation::Animation,
animator::Animator,
components::{sprite3d::Sprite3d, spritesheet_animation::SpritesheetAnimation},
events::AnimationEvent,
systems::{sprite3d, spritesheet_animation},
};
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
pub struct AnimationSystemSet;
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
pub struct Sprite3dSystemSet;
#[derive(Default)]
pub struct SpritesheetAnimationPlugin;
impl Plugin for SpritesheetAnimationPlugin {
fn build(&self, app: &mut App) {
app
.init_asset::<Animation>()
.register_type::<Animation>()
.register_type::<SpritesheetAnimation>()
.init_resource::<Animator>()
.register_type::<Animator>()
.add_systems(
PostUpdate,
spritesheet_animation::play_animations.in_set(AnimationSystemSet),
)
.add_message::<AnimationEvent>()
.init_resource::<sprite3d::Cache>()
.register_type::<sprite3d::Cache>()
.register_type::<Sprite3d>()
.add_systems(
PostUpdate,
(
sprite3d::setup_rendering,
sprite3d::sync_when_sprites_change,
sprite3d::sync_when_atlases_change,
)
.in_set(Sprite3dSystemSet)
.after(AnimationSystemSet),
);
}
}