|
use bevy::ecs::{ bundle::Bundle, component::Component };
|
|
use bevy_ecs_ldtk::{ prelude::LdtkEntity, utils::LdtkSpriteSheetBundle };
|
|
|
|
use super::{ ColliderBundle, PredefinedPath };
|
|
use crate::components::animals::Animal;
|
|
|
|
|
|
#[derive(Clone, Eq, PartialEq, Debug, Default, Component)]
|
|
pub struct Dog {
|
|
name: String,
|
|
}
|
|
|
|
|
|
impl Dog {
|
|
|
|
fn new(name: String) -> Self {
|
|
|
|
Self { name }
|
|
}
|
|
}
|
|
|
|
|
|
impl Animal for Dog {
|
|
|
|
fn species() -> &'static str {
|
|
"Dog"
|
|
}
|
|
|
|
|
|
fn name(&self) -> &String {
|
|
&self.name
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Default, Bundle, LdtkEntity)]
|
|
pub struct DogBundle {
|
|
#[sprite_sheet_bundle]
|
|
pub sprite_sheet_bundle: LdtkSpriteSheetBundle,
|
|
#[from_entity_instance]
|
|
pub collider_bundle: ColliderBundle,
|
|
pub dog: Dog,
|
|
}
|
|
|
|
#[derive(Clone, Default, Bundle, LdtkEntity)]
|
|
pub struct DogPatrolBundle {
|
|
#[ldtk_entity]
|
|
pub dog: DogBundle,
|
|
#[ldtk_entity]
|
|
pub predefined_path: PredefinedPath,
|
|
}
|
|
|