bevy/examples/state
MiniaczQ 49338245ea
Generalize StateTransitionEvent<S> to allow identity transitions (#13579)
# Objective

This PR addresses one of the issues from [discord state
discussion](https://discord.com/channels/691052431525675048/1237949214017716356).
Same-state transitions can be desirable, so there should exist a hook
for them.

Fixes https://github.com/bevyengine/bevy/issues/9130.

## Solution

- Allow `StateTransitionEvent<S>` to contain identity transitions.
- Ignore identity transitions at schedule running level (`OnExit`,
`OnTransition`, `OnEnter`).
- Propagate identity transitions through `SubStates` and
`ComputedStates`.
- Add example about registering custom transition schedules.

## Changelog

- `StateTransitionEvent<S>` can be emitted with same `exited` and
`entered` state.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-06-04 14:23:24 +00:00
..
computed_states.rs Move utilities from examples to bevy_state and add concept of state-scoped entities (#13649) 2024-06-04 11:44:34 +00:00
custom_transitions.rs Generalize StateTransitionEvent<S> to allow identity transitions (#13579) 2024-06-04 14:23:24 +00:00
states.rs Generalize StateTransitionEvent<S> to allow identity transitions (#13579) 2024-06-04 14:23:24 +00:00
sub_states.rs Move utilities from examples to bevy_state and add concept of state-scoped entities (#13649) 2024-06-04 11:44:34 +00:00