use super::component_prelude::*;
#[derive(Serialize, Deserialize, Default)]
pub struct Solid<T>
where
T: SolidTag,
{
pub tag: T,
}
impl<T> Solid<T>
where
T: SolidTag,
{
pub fn new(tag: T) -> Self {
Self { tag }
}
}
impl<T> Component for Solid<T>
where
T: 'static + SolidTag,
{
type Storage = VecStorage<Self>;
}
pub trait SolidTag: Send + Sync + Default + Clone {
fn collides_with(&self, other: &Self) -> bool;
}
impl<T> SolidTag for T
where
T: Send + Sync + Default + Clone + PartialEq,
{
fn collides_with(&self, other: &Self) -> bool {
self == other
}
}