Trait bevy::state::app::AppExtStates
source · pub trait AppExtStates {
// Required methods
fn init_state<S>(&mut self) -> &mut Self
where S: FreelyMutableState + FromWorld;
fn insert_state<S>(&mut self, state: S) -> &mut Self
where S: FreelyMutableState;
fn add_computed_state<S>(&mut self) -> &mut Self
where S: ComputedStates;
fn add_sub_state<S>(&mut self) -> &mut Self
where S: SubStates;
fn enable_state_scoped_entities<S>(&mut self) -> &mut Self
where S: States;
}
Required Methods§
sourcefn init_state<S>(&mut self) -> &mut Selfwhere
S: FreelyMutableState + FromWorld,
fn init_state<S>(&mut self) -> &mut Selfwhere
S: FreelyMutableState + FromWorld,
Initializes a State
with standard starting values.
This method is idempotent: it has no effect when called again using the same generic type.
Adds State<S>
and NextState<S>
resources, and enables use of the [OnEnter
], [OnTransition
] and [OnExit
] schedules.
These schedules are triggered before Update
and at startup.
If you would like to control how other systems run based on the current state, you can
emulate this behavior using the [in_state
] [Condition
].
Note that you can also apply state transitions at other points in the schedule
by triggering the StateTransition
schedule manually.
sourcefn insert_state<S>(&mut self, state: S) -> &mut Selfwhere
S: FreelyMutableState,
fn insert_state<S>(&mut self, state: S) -> &mut Selfwhere
S: FreelyMutableState,
Inserts a specific State
to the current App
and overrides any State
previously
added of the same type.
Adds State<S>
and NextState<S>
resources, and enables use of the [OnEnter
], [OnTransition
] and [OnExit
] schedules.
These schedules are triggered before Update
and at startup.
If you would like to control how other systems run based on the current state, you can
emulate this behavior using the [in_state
] [Condition
].
Note that you can also apply state transitions at other points in the schedule
by triggering the StateTransition
schedule manually.
sourcefn add_computed_state<S>(&mut self) -> &mut Selfwhere
S: ComputedStates,
fn add_computed_state<S>(&mut self) -> &mut Selfwhere
S: ComputedStates,
Sets up a type implementing ComputedStates
.
This method is idempotent: it has no effect when called again using the same generic type.
sourcefn add_sub_state<S>(&mut self) -> &mut Selfwhere
S: SubStates,
fn add_sub_state<S>(&mut self) -> &mut Selfwhere
S: SubStates,
Sets up a type implementing SubStates
.
This method is idempotent: it has no effect when called again using the same generic type.
sourcefn enable_state_scoped_entities<S>(&mut self) -> &mut Selfwhere
S: States,
fn enable_state_scoped_entities<S>(&mut self) -> &mut Selfwhere
S: States,
Enable state-scoped entity clearing for state S
.
For more information refer to StateScoped
.