draw tile

This commit is contained in:
Tao Tien 2026-01-13 13:07:21 -08:00
parent 6e6b792a58
commit b5e670b491
5 changed files with 82 additions and 41 deletions

View file

@ -1,7 +1,10 @@
use bevy::prelude::*;
use strum::{EnumCount, FromRepr};
use crate::{EnumNextCycle, game::GameState};
use crate::{
EnumNextCycle,
game::{GameState, hand::DrawnTile, wall::Wall},
};
#[derive(Component)]
pub(crate) struct Dice(u8, u8);
@ -84,3 +87,23 @@ impl EnumNextCycle for TurnState {
}
}
}
pub(crate) fn tsumo(
mut commands: Commands,
curr_player: Res<CurrentPlayer>,
// players: Populated<Entity, With<Player>>,
wall_ent: Single<Entity, With<Wall>>,
walltiles: Single<&Children, With<Wall>>,
curr_turnstate: Res<State<TurnState>>,
mut next_turnstate: ResMut<NextState<TurnState>>,
) {
trace!("tsumo for: {:?}", curr_player.0);
let drawn = walltiles.last().unwrap();
commands.entity(*wall_ent).remove_child(*drawn);
commands.entity(curr_player.0).insert(DrawnTile(*drawn));
debug!("drew: {:?}", drawn);
next_turnstate.set(curr_turnstate.next());
}