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