pub fn start_player_choice_phase(
  mut commands: Commands,
  mut turn_event: EventReader<EndTurn>,
  mut turn_ui_state: ResMut<TurnUIState>,
  player_health: Query<(&EntityHealth, &MapEntityType), With<PlayerStatus>>,
) {
  if turn_event.iter().count() != 0 {
    turn_ui_state.status = TurnStatus::PlayerChoosing;

    let mut ct = CompletedTurn {
      warrior_health: 0.,
      wizard_health: 0.,
    };
    for (h, pt) in player_health.iter() {
      if let MapEntityType::Player(crate::map_entities::PlayerType::Warrior) = pt {
        ct.warrior_health = h.health;
      } else {
        ct.wizard_health = h.health;
      }
    }

    commands.spawn().insert(ct);
  }
}
/// Fires after the turn animation has completed.
/// In charge of setting the correct state so that the player can choose their next action
Fires after the turn animation has completed.
In charge of setting the correct state so that the player can choose their next action
Fires after the turn animation has completed . In charge of setting the correct state so that the player can choose their next action
pub fn start_player_choice_phase(
  mut commands: Commands,
  mut turn_event: EventReader<EndTurn>,
  mut turn_ui_state: ResMut<TurnUIState>,
  player_health: Query<(&EntityHealth, &MapEntityType), With<PlayerStatus>>,
) {
  if turn_event.iter().count() != 0 {
    turn_ui_state.status = TurnStatus::PlayerChoosing;
    let mut ct = CompletedTurn {
      warrior_health: 0.,
      wizard_health: 0.,
    };
    for (h, pt) in player_health.iter() {
      if let MapEntityType::Player(crate::map_entities::PlayerType::Warrior) = pt {
        ct.warrior_health = h.health;
      } else {
        ct.wizard_health = h.health;
      }
    }
    commands.spawn().insert(ct);
  }
}
pub fn start_player_choice_phase ( mut commands : Commands , mut turn_event : EventReader < EndTurn > , mut turn_ui_state : ResMut < TurnUIState > , player_health : Query < ( & EntityHealth , & MapEntityType ) , With < PlayerStatus > > , ) { if turn_event . iter ( ) . count ( ) != 0 { turn_ui_state . status = TurnStatus :: PlayerChoosing ; let mut ct = CompletedTurn { warrior_health : 0. , wizard_health : 0. , } ; for ( h , pt ) in player_health . iter ( ) { if let MapEntityType :: Player ( crate :: map_entities :: PlayerType :: Warrior ) = pt { ct . warrior_health = h . health ; } else { ct . wizard_health = h . health ; } } commands . spawn ( ) . insert ( ct ) ; } }
Fires after the turn animation has completed.
Fires after the turn animation has completed .
commands
Commands
turn_event
EventReader<EndTurn>
turn_ui_state
ResMut<TurnUIState>
player_health
Query<(&EntityHealth, &MapEntityType), With<PlayerStatus>>
commands
Commands
turn_event
EventReader<EndTurn>
turn_ui_state
ResMut<TurnUIState>
player_health
Query<(&EntityHealth, &MapEntityType), With<PlayerStatus>>