From d95549070bfd10b6c7551196b89d7cf50ed6c596 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 9 Aug 2024 13:49:42 -0700 Subject: [PATCH] gameplay_attributes: split out collision variants into structs --- src/gameplay_attributes.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gameplay_attributes.rs b/src/gameplay_attributes.rs index 064bbcb..f600ab3 100644 --- a/src/gameplay_attributes.rs +++ b/src/gameplay_attributes.rs @@ -150,23 +150,24 @@ impl IntersectingAttributes{ } #[derive(Clone,Copy,id::Id,Hash,Eq,PartialEq)] 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)] pub enum CollisionAttributes{ Decoration,//visual only - Contact{//track whether you are contacting the object - contacting:ContactingAttributes, - general:GeneralAttributes, - }, - Intersect{//track whether you are intersecting the object - intersecting:IntersectingAttributes, - general:GeneralAttributes, - }, + Contact(ContactAttributes),//track whether you are contacting the object + Intersect(IntersectAttributes),//track whether you are intersecting the object } impl CollisionAttributes{ pub fn contact_default()->Self{ - Self::Contact{ - contacting:ContactingAttributes::default(), - general:GeneralAttributes::default() - } + Self::Contact(ContactAttributes::default()) } }