pub trait SessionRunner: Sync + Send + 'static {
    // Required methods
    fn step(
        &mut self,
        now: Instant,
        world: &mut World,
        stages: &mut SystemStages
    );
    fn restart_session(&mut self);
}
Expand description

A session runner is in charge of advancing a Session simulation.

Required Methods§

source

fn step(&mut self, now: Instant, world: &mut World, stages: &mut SystemStages)

Step the simulation once.

It is the responsibility of the session runner to update the Time resource if necessary.

If no special behavior is desired, the simplest session runner, and the one that is implemented by DefaultSessionRunner is as follows:

fn step(&mut self, now: Instant, world: &mut World, stages: &mut SystemStages) {
    world.resource_mut::<Time>().update_with_instant(now);
    stages.run(world);
}
fn restart_session(&mut self) {}
source

fn restart_session(&mut self)

Restart Session Runner. This should reset accumulated time, inputs, etc.

The expectation is that current players using it may continue to, so something like a network socket or player info should persist.

Implementors§