diff --git a/src/data_block.rs b/src/data_block.rs index f9dc2cb..82387c4 100644 --- a/src/data_block.rs +++ b/src/data_block.rs @@ -116,7 +116,6 @@ impl BlockType { } } - #[derive(Component)] /// Position du block. pub struct BlockPosition { @@ -127,25 +126,6 @@ pub struct BlockPosition { pub y: u8, } -impl BlockPosition { - /// Retourne la position en x et y dans la map en foction de la position abstraite. - pub fn to_transform(&self, identity: Identity) -> Transform { - let max_y: u8 = 9; - let max_x = 10.; - let new_y = max_y - 1 - self.y; - let offset_x = new_y % 2; - - let mut new_x = (offset_x as f32).mul_add(0.5, self.x as f32); - if identity == Identity::Joueur2 { - new_x = max_x - new_x; - }; - - Transform::from_xyz(new_x, new_y as f32 * 0.42, self.y as f32) - .with_scale(Vec3::splat(1.0 / 185.0)) - } -} - - #[derive(Debug, Clone, Copy, PartialEq, Eq, Component)] /// Permet de donné un idée a un joueur ou un block pour lui donné une identité. pub struct Id { @@ -155,12 +135,8 @@ pub struct Id { impl Id { /// Permet de verifier l'Id du joueur avec une Id donné - pub fn verifi_id(&self, id_a_verifie: &Id) -> bool { - if self.id == id_a_verifie.id { - true - } else { - false - } + pub const fn verifi_id(&self, id_a_verifie: &Self) -> bool { + self.id == id_a_verifie.id } } diff --git a/src/lib.rs b/src/lib.rs index b307c1c..5015cdd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,3 +9,4 @@ #![deny(warnings)] // TODO +pub mod data_block;