diff --git a/crates/bevy_state/src/state/sub_states.rs b/crates/bevy_state/src/state/sub_states.rs index 207ef74e240ef..c978780ba0534 100644 --- a/crates/bevy_state/src/state/sub_states.rs +++ b/crates/bevy_state/src/state/sub_states.rs @@ -150,7 +150,7 @@ pub trait SubStates: States + FreelyMutableState { /// /// This can either be a single type that implements [`States`], or a tuple /// containing multiple types that implement [`States`], or any combination of - /// types implementing [`States`] and Options of types implementing [`States`] + /// types implementing [`States`] and Options of types implementing [`States`]. type SourceStates: StateSet; /// This function gets called whenever one of the [`SourceStates`](Self::SourceStates) changes. diff --git a/crates/bevy_state/src/state/transitions.rs b/crates/bevy_state/src/state/transitions.rs index 8995b596e926a..747e09d9dd874 100644 --- a/crates/bevy_state/src/state/transitions.rs +++ b/crates/bevy_state/src/state/transitions.rs @@ -53,25 +53,23 @@ pub struct StateTransitionEvent { pub entered: Option, } -/// Applies manual state transitions using [`NextState`]. +/// Applies state transitions and runs transitions schedules in order. /// /// These system sets are run sequentially, in the order of the enum variants. #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] pub(crate) enum StateTransitionSteps { - /// Parentless states apply their [`NextState`]. - RootTransitions, - /// States with parents apply their computation and [`NextState`]. + /// States apply their transitions from [`NextState`] and compute functions based on their parent states. DependentTransitions, - /// Exit schedules are executed in leaf-root order + /// Exit schedules are executed in leaf to root order ExitSchedules, /// Transition schedules are executed in arbitrary order. TransitionSchedules, - /// Enter schedules are executed in root-leaf order. + /// Enter schedules are executed in root to leaf order. EnterSchedules, } #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] -/// Exit schedules are executed. +/// System set that runs exit schedule(s) for state `S`. pub struct ExitSchedules(PhantomData); impl Default for ExitSchedules { @@ -81,7 +79,7 @@ impl Default for ExitSchedules { } #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] -/// Transition schedules are executed. +/// System set that runs transition schedule(s) for state `S`. pub struct TransitionSchedules(PhantomData); impl Default for TransitionSchedules { @@ -91,7 +89,7 @@ impl Default for TransitionSchedules { } #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] -/// Enter schedules are executed. +/// System set that runs enter schedule(s) for state `S`. pub struct EnterSchedules(PhantomData); impl Default for EnterSchedules { @@ -100,7 +98,7 @@ impl Default for EnterSchedules { } } -/// Defines a system set to aid with dependent state ordering. +/// System set that applies transitions for state `S`. #[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)] pub(crate) struct ApplyStateTransition(PhantomData); @@ -181,7 +179,6 @@ pub fn setup_state_transitions_in_world( let mut schedule = Schedule::new(StateTransition); schedule.configure_sets( ( - StateTransitionSteps::RootTransitions, StateTransitionSteps::DependentTransitions, StateTransitionSteps::ExitSchedules, StateTransitionSteps::TransitionSchedules,