#Sequence of Actions

13 messages · Page 1 of 1 (latest)

stark crag
#

I'd like to execute some code in sequence and retain access to information that has been computed, without the overhead of events. Events work great for generic handling of an event, but in my case, I have an explicit sequence of things that need to happen, that don't need the generality of response handling provided by events. Also, there's various data that was computed in the first step of the sequence that I'd like to access in the second step of the sequence.

Looking for suggestions on how to do this in the most direct / least boilerplatey way.

mossy crest
stark crag
#

I read about these in the cheat book and I don't think this handles the issue

#

But ill take a look at this example

#

Essentially I want to be able to just do

// I have some data I want to use later.
commands.spawn(
    Animator::new(Tween::new(
        EaseMethod::Linear,
        Duration::from_secs_f32(new_path.net_length / UNIT_SPEED),
        LerpableCurveLens(new_path.clone()),
    ),
    // Wait for this event to happen
    On::<MyTweenCompleted>::event().await,
)
// Execute more stuff using the data from above
#

Obviously the code snippet is nonsense, but demonstrates the ideal pattern I want to follow

stark crag
stark crag
#

Maybe I can desecrate pecs to fit my usecase

stark crag
#

What's the most direct way of modeling a sequential process ?

shy crest
stark crag
#

Already been suggested, and that doesn't address the issue

#

I also saw bevy_defer. Another option

shy crest