Asserts about game piece state...

main
Elijah C. Voigt 1 year ago
parent 1a9c774ccf
commit 3e29298214

@ -1123,7 +1123,7 @@ fn setup_dissolve_materials(
// Used to insert Handle<DissolveMaterial>; // Used to insert Handle<DissolveMaterial>;
mut commands: Commands, mut commands: Commands,
) { ) {
info!("Setting up dissolve materials..."); debug!("Setting up dissolve materials...");
events events
.iter() .iter()
// Handle this entity (mesh) // Handle this entity (mesh)
@ -1132,7 +1132,7 @@ fn setup_dissolve_materials(
.iter_many(parents.iter_ancestors(child)) .iter_many(parents.iter_ancestors(child))
.next() { .next() {
info!("Setting up dissolve material for {:?} {:?}", name, child); debug!("Setting up dissolve material for {:?} {:?}", name, child);
// Extension we will add to existing gltf-sourced materials // Extension we will add to existing gltf-sourced materials
let extension = DissolveExtension { let extension = DissolveExtension {
@ -1176,7 +1176,7 @@ fn capture_piece(
mut timer: Local<f32>, mut timer: Local<f32>,
time: Res<Time>, time: Res<Time>,
) { ) {
info!("Running capture piece routine"); debug!("Running capture piece routine");
match *state { match *state {
// State is None, so we need to initiate the animation // State is None, so we need to initiate the animation
None => { None => {
@ -1219,7 +1219,7 @@ fn capture_piece(
score.captures(!*side).saturating_sub(1), score.captures(!*side).saturating_sub(1),
t.translation t.translation
); );
info!("Setting translation for captured piece {:?}", entity); debug!("Setting translation for captured piece {:?}", entity);
t.translation = t.translation =
capture_translation(side, score.captures(!*side).saturating_sub(1)); capture_translation(side, score.captures(!*side).saturating_sub(1));
@ -1402,7 +1402,7 @@ fn fixup_shadows(
mut point_lights: Query<&mut PointLight>, mut point_lights: Query<&mut PointLight>,
mut directional_lights: Query<&mut DirectionalLight>, mut directional_lights: Query<&mut DirectionalLight>,
) { ) {
info!("Fixing up shadows"); debug!("Fixing up shadows");
spot_lights.iter_mut().for_each(|(mut l, n)| { spot_lights.iter_mut().for_each(|(mut l, n)| {
if n.as_str().starts_with("Spot") { if n.as_str().starts_with("Spot") {
l.shadows_enabled = true; l.shadows_enabled = true;

@ -28,6 +28,11 @@ impl Plugin for GamePlugin {
check_endgame.run_if(resource_changed::<Board>), check_endgame.run_if(resource_changed::<Board>),
).run_if(in_state(GameState::Play)), ).run_if(in_state(GameState::Play)),
) )
.add_systems(Update,
assert_piece_consistency
.run_if(in_state(GameState::Play))
.run_if(resource_changed::<Score>)
)
.add_systems(Update, reset_game.run_if(in_state(GameState::Restart))) .add_systems(Update, reset_game.run_if(in_state(GameState::Restart)))
.add_systems(OnEnter(GameState::Endgame), set_endgame.after(manage_score)) .add_systems(OnEnter(GameState::Endgame), set_endgame.after(manage_score))
.add_systems(OnExit(GameState::Endgame), clear_endgame) .add_systems(OnExit(GameState::Endgame), clear_endgame)
@ -1464,3 +1469,9 @@ fn handle_quit(mut app_exit_events: EventWriter<AppExit>) {
fn handle_restart(mut game_state: ResMut<NextState<GameState>>) { fn handle_restart(mut game_state: ResMut<NextState<GameState>>) {
game_state.set(GameState::Play); game_state.set(GameState::Play);
} }
fn assert_piece_consistency(
query: Query<Entity, (With<Piece>, Or<(With<BoardIndex>, With<BeingCaptured>, With<Captured>)>)>
) {
assert_eq!(query.iter().len(), 18, "Pieces does does not add up!");
}
Loading…
Cancel
Save