59 lines
1 KiB
Rust
59 lines
1 KiB
Rust
|
|
use bevy::prelude::*;
|
||
|
|
use strum::FromRepr;
|
||
|
|
|
||
|
|
#[derive(Component)]
|
||
|
|
pub(crate) enum Tile {
|
||
|
|
Pin(Number),
|
||
|
|
Sou(Number),
|
||
|
|
Man(Number),
|
||
|
|
Wind(Wind),
|
||
|
|
Dragon(Dragon),
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(FromRepr)]
|
||
|
|
pub(crate) enum Number {
|
||
|
|
One = 1,
|
||
|
|
Two,
|
||
|
|
Three,
|
||
|
|
Four,
|
||
|
|
Five,
|
||
|
|
Six,
|
||
|
|
Seven,
|
||
|
|
Eight,
|
||
|
|
Nine,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(FromRepr)]
|
||
|
|
pub(crate) enum Wind {
|
||
|
|
Ton,
|
||
|
|
Nan,
|
||
|
|
Shaa,
|
||
|
|
Pei,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(FromRepr)]
|
||
|
|
pub(crate) enum Dragon {
|
||
|
|
Haku,
|
||
|
|
Hatsu,
|
||
|
|
Chun,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Component)]
|
||
|
|
pub(crate) struct Dora;
|
||
|
|
|
||
|
|
pub fn init_tiles(mut commands: Commands) {
|
||
|
|
for _ in 0..4 {
|
||
|
|
for i in 1..=9 {
|
||
|
|
commands.spawn((Tile::Pin(Number::from_repr(i).unwrap()),));
|
||
|
|
commands.spawn((Tile::Sou(Number::from_repr(i).unwrap()),));
|
||
|
|
commands.spawn((Tile::Man(Number::from_repr(i).unwrap()),));
|
||
|
|
}
|
||
|
|
for i in 0..4 {
|
||
|
|
commands.spawn((Tile::Wind(Wind::from_repr(i).unwrap()),));
|
||
|
|
}
|
||
|
|
for i in 0..3 {
|
||
|
|
commands.spawn((Tile::Dragon(Dragon::from_repr(i).unwrap()),));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|