1use bevy::ecs::{
2 component::Component,
3 entity::Entity,
4 template::{EntityTemplate, FromTemplate, Template},
5};
6
7#[derive(Component)]
9pub struct Target(pub Entity);
10
11impl FromTemplate for Target {
12 type Template = TargetTemplate;
13}
14
15#[derive(Default)]
16pub struct TargetTemplate(pub EntityTemplate);
17
18impl Template for TargetTemplate {
19 type Output = Target;
20
21 fn build_template(
22 &self,
23 context: &mut bevy::ecs::template::TemplateContext,
24 ) -> bevy::ecs::error::Result<Self::Output> {
25 Ok(Target(self.0.build_template(context)?))
26 }
27
28 fn clone_template(&self) -> Self {
29 TargetTemplate(self.0)
30 }
31}