Move elements to new module
This commit is contained in:
parent
fe503f51de
commit
020260a2f3
|
@ -0,0 +1,18 @@
|
|||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Element {
|
||||
None,
|
||||
Air,
|
||||
Sand,
|
||||
Water,
|
||||
}
|
||||
|
||||
impl From<u32> for Element {
|
||||
fn from(value: u32) -> Self {
|
||||
match value {
|
||||
x if x == Element::Air as u32 => Element::Air,
|
||||
x if x == Element::Sand as u32 => Element::Sand,
|
||||
x if x == Element::Water as u32 => Element::Water,
|
||||
_ => Element::None,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
mod element;
|
||||
mod rules;
|
||||
|
||||
use bevy::{
|
||||
|
@ -17,7 +18,10 @@ use rand::Rng;
|
|||
|
||||
use crate::util::DirtyRect;
|
||||
|
||||
use self::rules::{to_rule_state, FallingSandRules};
|
||||
use self::{
|
||||
element::Element,
|
||||
rules::{to_rule_state, FallingSandRules},
|
||||
};
|
||||
|
||||
pub struct FallingSandPlugin;
|
||||
|
||||
|
@ -222,22 +226,3 @@ pub fn update_chunk_texture_system(
|
|||
chunk.dirty_rect.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Element {
|
||||
None,
|
||||
Air,
|
||||
Sand,
|
||||
Water,
|
||||
}
|
||||
|
||||
impl From<u32> for Element {
|
||||
fn from(value: u32) -> Self {
|
||||
match value {
|
||||
x if x == Element::Air as u32 => Element::Air,
|
||||
x if x == Element::Sand as u32 => Element::Sand,
|
||||
x if x == Element::Water as u32 => Element::Water,
|
||||
_ => Element::None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue