init wall
This commit is contained in:
parent
76b720b0a2
commit
3fb03cfbcb
7 changed files with 69 additions and 27 deletions
42
src/tiles.rs
42
src/tiles.rs
|
|
@ -1,8 +1,26 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy::{ecs::entity::MapEntities, prelude::*};
|
||||
use strum::FromRepr;
|
||||
|
||||
use crate::game::wall::Wall;
|
||||
|
||||
// #[derive(Component)]
|
||||
// #[derive(relasionship(re))]
|
||||
// pub struct TileEntity {
|
||||
// #[relationship]
|
||||
// pub parent: Entity,
|
||||
|
||||
// r#type: Tile,
|
||||
// }
|
||||
|
||||
struct Hand;
|
||||
|
||||
#[derive(Component)]
|
||||
pub enum Tile {
|
||||
pub struct Tile {
|
||||
suit: Suit,
|
||||
}
|
||||
|
||||
#[derive(MapEntities)]
|
||||
pub enum Suit {
|
||||
Pin(Rank),
|
||||
Sou(Rank),
|
||||
Man(Rank),
|
||||
|
|
@ -34,15 +52,25 @@ pub struct Dora;
|
|||
pub fn init_tiles(mut commands: Commands) {
|
||||
for _ in 0..4 {
|
||||
for i in 1..=9 {
|
||||
commands.spawn(Tile::Pin(Rank(i)));
|
||||
commands.spawn(Tile::Sou(Rank(i)));
|
||||
commands.spawn(Tile::Man(Rank(i)));
|
||||
commands.spawn(Tile {
|
||||
suit: Suit::Pin(Rank(i)),
|
||||
});
|
||||
commands.spawn(Tile {
|
||||
suit: Suit::Sou(Rank(i)),
|
||||
});
|
||||
commands.spawn(Tile {
|
||||
suit: Suit::Man(Rank(i)),
|
||||
});
|
||||
}
|
||||
for i in 0..4 {
|
||||
commands.spawn(Tile::Wind(Wind::from_repr(i).unwrap()));
|
||||
commands.spawn(Tile {
|
||||
suit: Suit::Wind(Wind::from_repr(i).unwrap()),
|
||||
});
|
||||
}
|
||||
for i in 0..3 {
|
||||
commands.spawn(Tile::Dragon(Dragon::from_repr(i).unwrap()));
|
||||
commands.spawn(Tile {
|
||||
suit: Suit::Dragon(Dragon::from_repr(i).unwrap()),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue