|
|
|
@ -72,6 +72,7 @@ impl Plugin for Display3dPlugin {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
setup_capture_piece.run_if(any_component_changed::<Handle<StandardMaterial>>),
|
|
|
|
setup_capture_piece.run_if(any_component_changed::<Handle<StandardMaterial>>),
|
|
|
|
capture_piece.run_if(any_with_component::<game::Captured>()),
|
|
|
|
capture_piece.run_if(any_with_component::<game::Captured>()),
|
|
|
|
|
|
|
|
skip_animation.run_if(|keys: Res<Input<KeyCode>>| -> bool { keys.just_pressed(KeyCode::Return) }),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.add_systems(
|
|
|
|
.add_systems(
|
|
|
|
@ -87,22 +88,12 @@ impl Plugin for Display3dPlugin {
|
|
|
|
.run_if(in_state(GameState::Play))
|
|
|
|
.run_if(in_state(GameState::Play))
|
|
|
|
.run_if(in_state(DisplayState::Display3d)),
|
|
|
|
.run_if(in_state(DisplayState::Display3d)),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.add_systems(
|
|
|
|
|
|
|
|
OnEnter(DisplayState::Display3d),
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
activate::<Display3d>,
|
|
|
|
|
|
|
|
set_piece_texture.run_if(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
|
|
|
|
opening_animation
|
|
|
|
|
|
|
|
.run_if(run_once())
|
|
|
|
|
|
|
|
.run_if(in_state(GameState::Play)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.add_systems(OnExit(DisplayState::Display3d), deactivate::<Display3d>)
|
|
|
|
.add_systems(OnExit(DisplayState::Display3d), deactivate::<Display3d>)
|
|
|
|
.add_systems(
|
|
|
|
.add_systems(
|
|
|
|
OnEnter(GameState::Play),
|
|
|
|
OnEnter(GameState::Play),
|
|
|
|
(
|
|
|
|
(
|
|
|
|
activate::<Display3d>.run_if(in_state(DisplayState::Display3d)),
|
|
|
|
activate::<Display3d>.run_if(in_state(DisplayState::Display3d)),
|
|
|
|
set_piece_texture,
|
|
|
|
set_piece_texture.run_if(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
update_tweaks.run_if(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
update_tweaks.run_if(resource_exists::<tweak::GameTweaks>()),
|
|
|
|
opening_animation
|
|
|
|
opening_animation
|
|
|
|
.run_if(run_once())
|
|
|
|
.run_if(run_once())
|
|
|
|
@ -998,6 +989,21 @@ fn opening_animation(mut players: Query<&mut AnimationPlayer, (With<Camera>, Wit
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// When called skips any running animations
|
|
|
|
|
|
|
|
fn skip_animation(
|
|
|
|
|
|
|
|
mut players: Query<&mut AnimationPlayer>,
|
|
|
|
|
|
|
|
clips: Res<Assets<AnimationClip>>,
|
|
|
|
|
|
|
|
time: Res<Time>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
players.iter_mut().for_each(|mut p| {
|
|
|
|
|
|
|
|
if let Some(c) = clips.get(p.animation_clip()) {
|
|
|
|
|
|
|
|
// HACK: We should be able to skip to the end of an animation
|
|
|
|
|
|
|
|
// But implementation details means this is as close as we can get...
|
|
|
|
|
|
|
|
p.seek_to(c.duration() - (2.0 * time.delta_seconds()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn switch_sides(
|
|
|
|
fn switch_sides(
|
|
|
|
mut players: Query<&mut AnimationPlayer, (With<Camera>, With<Display3d>)>,
|
|
|
|
mut players: Query<&mut AnimationPlayer, (With<Camera>, With<Display3d>)>,
|
|
|
|
gltfs: Res<Assets<Gltf>>,
|
|
|
|
gltfs: Res<Assets<Gltf>>,
|
|
|
|
|