use bevy::prelude::*;
#[derive(PartialOrd, PartialEq, Copy, Clone, Resource, Default, States, Debug, Hash, Eq)]
pub enum IntroState {
#[default]
Idle,
Loading,
Running,
Failure,
}
impl IntroState {
pub const fn is_running(&self) -> bool {
matches!(&self, IntroState::Running)
}
pub const fn is_loading(&self) -> bool {
matches!(&self, IntroState::Loading)
}
pub const fn is_failure(&self) -> bool {
matches!(&self, IntroState::Failure)
}
}
pub fn is_running(state: Res<State<IntroState>>) -> bool {
state.is_running()
}
pub fn is_loading(state: Res<State<IntroState>>) -> bool {
state.is_loading()
}
pub fn started_running(state: Res<State<IntroState>>) -> bool {
state.is_changed() && state.is_running()
}
pub fn is_failure(state: Res<State<IntroState>>) -> bool {
state.is_failure()
}