use std::marker::PhantomData;
use bevy_app::prelude::*;
use moonshine_util::reflect::Registerable;
use crate::{Behavior, Memory, Transition, TransitionQueue};
pub struct BehaviorPlugin<T: Behavior>(PhantomData<T>);
impl<T: Behavior> Default for BehaviorPlugin<T> {
fn default() -> Self {
Self(PhantomData)
}
}
impl<T: Behavior + Registerable> Plugin for BehaviorPlugin<T> {
fn build(&self, app: &mut App) {
app.register_type::<Transition<T>>()
.register_type::<Memory<T>>()
.register_type::<TransitionQueue<T>>()
.register_required_components::<T, Transition<T>>();
}
}