gameplay_attributes: split out collision variants into structs

This commit is contained in:
Quaternions 2024-08-09 13:49:42 -07:00
parent af1f1aad14
commit d95549070b

View File

@ -150,23 +150,24 @@ impl IntersectingAttributes{
} }
#[derive(Clone,Copy,id::Id,Hash,Eq,PartialEq)] #[derive(Clone,Copy,id::Id,Hash,Eq,PartialEq)]
pub struct CollisionAttributesId(u32); pub struct CollisionAttributesId(u32);
#[derive(Clone,Default,Hash,Eq,PartialEq)]
pub struct ContactAttributes{
pub contacting:ContactingAttributes,
pub general:GeneralAttributes,
}
#[derive(Clone,Default,Hash,Eq,PartialEq)]
pub struct IntersectAttributes{
pub intersecting:IntersectingAttributes,
pub general:GeneralAttributes,
}
#[derive(Clone,Hash,Eq,PartialEq)] #[derive(Clone,Hash,Eq,PartialEq)]
pub enum CollisionAttributes{ pub enum CollisionAttributes{
Decoration,//visual only Decoration,//visual only
Contact{//track whether you are contacting the object Contact(ContactAttributes),//track whether you are contacting the object
contacting:ContactingAttributes, Intersect(IntersectAttributes),//track whether you are intersecting the object
general:GeneralAttributes,
},
Intersect{//track whether you are intersecting the object
intersecting:IntersectingAttributes,
general:GeneralAttributes,
},
} }
impl CollisionAttributes{ impl CollisionAttributes{
pub fn contact_default()->Self{ pub fn contact_default()->Self{
Self::Contact{ Self::Contact(ContactAttributes::default())
contacting:ContactingAttributes::default(),
general:GeneralAttributes::default()
}
} }
} }