I dont hate this.

main
Elijah C. Voigt 1 year ago
parent fcf39c2cf4
commit 81d90ae837

@ -86,13 +86,21 @@ impl Plugin for Display3dPlugin {
switch_sides
.run_if(in_state(GameState::Play))
.run_if(state_changed::<game::TurnState>)
.run_if(in_state(ai::PlayState::Human)),
.run_if(in_state(ai::PlayState::Human))
.run_if(any_component_added::<Selected>()
.or_else(any_component_removed::<Selected>())
),
// vantage point camera when playing against AI
vantage_point
.run_if(in_state(GameState::Play))
.run_if(in_state(PlayState::AiBogo)
.and_then(in_state(TurnState(Side::B)).and_then(any_component_added::<Selected>().or_else(any_component_removed::<Selected>())))
.or_else(in_state(PlayState::Human).and_then(not(state_changed::<TurnState>)))
),
.run_if(in_state(PlayState::AiBogo).and_then(in_state(TurnState(Side::B))))
.run_if(any_component_added::<Selected>().or_else(any_component_removed::<Selected>())),
// vantage point camera when playing against human
vantage_point
.run_if(in_state(GameState::Play))
.run_if(in_state(PlayState::Human))
.run_if(not(state_changed::<TurnState>))
.run_if(any_component_added::<Selected>().or_else(any_component_removed::<Selected>())),
update_pieces
.run_if(resource_exists::<tweak::GameTweaks>)
.run_if(in_state(GameState::Play))

@ -206,7 +206,7 @@ fn init_play_menu(
// Opponent button
parent
.spawn((
ButtonAction(ai::PlayState::AiBogo),
ButtonAction(ai::PlayState::Human),
ButtonBundle {
style: Style {
padding: UiRect::all(Val::Px(2.0)),
@ -224,7 +224,7 @@ fn init_play_menu(
parent.spawn(TextBundle {
text: Text {
sections: vec![TextSection {
value: "Opponent: AI".into(),
value: "Human Opponent".into(),
style: TextStyle {
color: Color::WHITE,
font_size: 12.0,
@ -388,7 +388,7 @@ fn handle_button_press<S: States + Clone + Component>(
fn manage_ai_button(
mut curr: Res<State<ai::PlayState>>,
curr: Res<State<ai::PlayState>>,
mut query: Query<(&mut ButtonAction<PlayState>, &Children)>,
mut texts: Query<&mut Text>,
) {
@ -402,8 +402,8 @@ fn manage_ai_button(
texts.get_mut(*c).iter_mut().for_each(|t| {
t.sections.iter_mut().for_each(|s| {
s.value = match ba.0 {
PlayState::AiBogo => "Opponent: AI".into(),
PlayState::Human => "Opponent: Human".into()
PlayState::AiBogo => "AI Opponent".into(),
PlayState::Human => "Human Opponent".into()
}
});
});

Loading…
Cancel
Save