mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 22:18:33 +00:00
add with_enter_stage (and other variants) (#1091)
This commit is contained in:
parent
9db38b7b97
commit
caf3d8b3ef
1 changed files with 15 additions and 0 deletions
|
@ -33,6 +33,21 @@ impl<T> Default for StateStage<T> {
|
|||
|
||||
#[allow(clippy::mem_discriminant_non_enum)]
|
||||
impl<T> StateStage<T> {
|
||||
pub fn with_enter_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||
self.set_enter_stage(state, stage);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_exit_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||
self.set_exit_stage(state, stage);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_update_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||
self.set_update_stage(state, stage);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_enter_stage<S: Stage>(&mut self, state: T, stage: S) -> &mut Self {
|
||||
let stages = self.state_stages(state);
|
||||
stages.enter = Box::new(stage);
|
||||
|
|
Loading…
Add table
Reference in a new issue