|
|
|
@ -41,7 +41,12 @@ impl Board {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct Play {}
|
|
|
|
|
pub struct Play {
|
|
|
|
|
pub throw_time: Duration,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Resource)]
|
|
|
|
|
struct Throwtime(Duration);
|
|
|
|
|
|
|
|
|
|
#[derive(Component, Debug)]
|
|
|
|
|
struct Action {
|
|
|
|
@ -211,6 +216,7 @@ fn handle_play(
|
|
|
|
|
mut events: EventReader<events::Play>,
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
mut board: ResMut<Board>,
|
|
|
|
|
throw_time: Res<Throwtime>,
|
|
|
|
|
) {
|
|
|
|
|
if events.is_empty() {
|
|
|
|
|
return;
|
|
|
|
@ -219,7 +225,7 @@ fn handle_play(
|
|
|
|
|
for e in events.iter() {
|
|
|
|
|
info!("play event {e:?}");
|
|
|
|
|
}
|
|
|
|
|
board.phase = Phase::Countdown(Timer::new(Duration::from_millis(3000), TimerMode::Once));
|
|
|
|
|
board.phase = Phase::Countdown(Timer::new(throw_time.0, TimerMode::Once));
|
|
|
|
|
board.clear();
|
|
|
|
|
info!("Starting countdown");
|
|
|
|
|
|
|
|
|
@ -234,7 +240,6 @@ fn handle_play(
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
border_color: Color::RED.into(),
|
|
|
|
|
background_color: Color::GRAY.into(),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
@ -307,5 +312,6 @@ impl Plugin for Play {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
app.insert_resource(Board::new());
|
|
|
|
|
app.insert_resource(Throwtime(self.throw_time));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|