fix error
This commit is contained in:
parent
788fe413ef
commit
29327b959a
|
@ -116,7 +116,6 @@ impl BlockType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
/// Position du block.
|
/// Position du block.
|
||||||
pub struct BlockPosition {
|
pub struct BlockPosition {
|
||||||
|
@ -127,25 +126,6 @@ pub struct BlockPosition {
|
||||||
pub y: u8,
|
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)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Component)]
|
||||||
/// Permet de donné un idée a un joueur ou un block pour lui donné une identité.
|
/// Permet de donné un idée a un joueur ou un block pour lui donné une identité.
|
||||||
pub struct Id {
|
pub struct Id {
|
||||||
|
@ -155,12 +135,8 @@ pub struct Id {
|
||||||
|
|
||||||
impl Id {
|
impl Id {
|
||||||
/// Permet de verifier l'Id du joueur avec une Id donné
|
/// Permet de verifier l'Id du joueur avec une Id donné
|
||||||
pub fn verifi_id(&self, id_a_verifie: &Id) -> bool {
|
pub const fn verifi_id(&self, id_a_verifie: &Self) -> bool {
|
||||||
if self.id == id_a_verifie.id {
|
self.id == id_a_verifie.id
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,4 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
pub mod data_block;
|
||||||
|
|
Loading…
Reference in a new issue