/// In charge of setting up the state to animate a turn
In charge of setting up the state to animate a turn
In charge of setting up the state to animate a turn
pub fn create_turn_animations(
  mut commands: Commands,
  mut turn_events: EventReader<StartTurn>,
  mut ui_state: ResMut<TurnUIState>,
) {
  if let Some(turn) = turn_events.iter().next() {
    let timer = Timer::from_seconds(constants::TURN_ANIMATION_DURATION, false);
    let displayer = TurnDisplayer { timer };
    match turn.0 {
      TurnStatus::PlayerRunning => {
        commands
          .spawn()
          .insert(displayer)
          .insert(PlayerTurnAnimating);
        ui_state.status = TurnStatus::PlayerRunning;
      }
      _ => {
        commands
          .spawn()
          .insert(displayer)
          .insert(EnemyTurnAnimating);
        ui_state.status = TurnStatus::EnemyRunning;
      }
    }
  }
  assert!(turn_events.iter().count() == 0);
}
pub fn create_turn_animations ( mut commands : Commands , mut turn_events : EventReader < StartTurn > , mut ui_state : ResMut < TurnUIState > , ) { if let Some ( turn ) = turn_events . iter ( ) . next ( ) { let timer = Timer :: from_seconds ( constants :: TURN_ANIMATION_DURATION , false ) ; let displayer = TurnDisplayer { timer } ; match turn . 0 { TurnStatus :: PlayerRunning => { commands . spawn ( ) . insert ( displayer ) . insert ( PlayerTurnAnimating ) ; ui_state . status = TurnStatus :: PlayerRunning ; } _ => { commands . spawn ( ) . insert ( displayer ) . insert ( EnemyTurnAnimating ) ; ui_state . status = TurnStatus :: EnemyRunning ; } } } assert ! ( turn_events iter ( ) count ( ) 0 ) ; }
In charge of setting up the state to animate a turn
In charge of setting up the state to animate a turn
commands
Commands
turn_events
EventReader<StartTurn>
ui_state
ResMut<TurnUIState>