Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniaczQ committed Jun 9, 2024
1 parent 34a8f70 commit ad188aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_state/src/state/sub_states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 8 additions & 11 deletions crates/bevy_state/src/state/transitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,23 @@ pub struct StateTransitionEvent<S: States> {
pub entered: Option<S>,
}

/// Applies manual state transitions using [`NextState<S>`].
/// 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<S>`].
RootTransitions,
/// States with parents apply their computation and [`NextState<S>`].
/// 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<S: States>(PhantomData<S>);

impl<S: States> Default for ExitSchedules<S> {
Expand All @@ -81,7 +79,7 @@ impl<S: States> Default for ExitSchedules<S> {
}

#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
/// Transition schedules are executed.
/// System set that runs transition schedule(s) for state `S`.
pub struct TransitionSchedules<S: States>(PhantomData<S>);

impl<S: States> Default for TransitionSchedules<S> {
Expand All @@ -91,7 +89,7 @@ impl<S: States> Default for TransitionSchedules<S> {
}

#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
/// Enter schedules are executed.
/// System set that runs enter schedule(s) for state `S`.
pub struct EnterSchedules<S: States>(PhantomData<S>);

impl<S: States> Default for EnterSchedules<S> {
Expand All @@ -100,7 +98,7 @@ impl<S: States> Default for EnterSchedules<S> {
}
}

/// 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<S: States>(PhantomData<S>);

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ad188aa

Please sign in to comment.