cargo fmt

main
Elijah C. Voigt 2 years ago
parent 207d691b2e
commit 7566ca1ca2

@ -13,13 +13,17 @@ impl Plugin for IntroPlugin {
.init_resource::<IntroProgress>()
.add_systems(OnEnter(GameState::Intro), activate::<Intro>)
.add_systems(OnExit(GameState::Intro), deactivate::<Intro>)
.add_systems(Update, manage_intro_progress
.add_systems(
Update,
manage_intro_progress
.run_if(in_state(GameState::Intro))
.run_if(not(resource_exists::<IntroPlayed>()))
.run_if(not(resource_exists::<IntroPlayed>())),
)
.add_systems(Update, play_intro
.add_systems(
Update,
play_intro
.run_if(in_state(GameState::Intro))
.run_if(resource_changed::<IntroProgress>())
.run_if(resource_changed::<IntroProgress>()),
)
// Continue to play state if the intro is done playing out
.add_systems(
@ -106,9 +110,7 @@ fn manage_intro_progress(
commands.insert_resource(IntroPlayed);
// Otherwise progress by N characters (1)
} else {
let tweak = tweaks
.get(tweaks_file.handle.clone())
.expect("Load tweaks");
let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks");
let rate = tweak.get::<u32>("intro_rate").expect("[intro] rate = #");
progress.0 = ((framecount.0 - *start) / rate) as usize;
@ -133,9 +135,7 @@ fn play_intro(
.iter_mut()
.enumerate()
// Only operate on sections up to this point
.filter_map(|(i, s)| {
(i <= progress.0).then_some(s)
})
.filter_map(|(i, s)| (i <= progress.0).then_some(s))
// Set the alpha to 1.0 making it visible
.for_each(|s| {
s.style.color.set_a(1.0);

Loading…
Cancel
Save