Run snap system after direction is updated.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1ff98c9132
commit
3994fef9d0
|
@ -379,25 +379,36 @@ where
|
|||
.get_resource::<NavigationConfig<S, A>>()
|
||||
.unwrap()
|
||||
.clone();
|
||||
const SNAP: &str = "SNAP";
|
||||
app.init_resource::<Snapping>()
|
||||
.register_type::<MaxSpeed>()
|
||||
.register_type::<RotationSpeed>()
|
||||
.register_type::<Sprinting>()
|
||||
.add_system(update_direction)
|
||||
.add_system(update_direction.before(SNAP))
|
||||
.add_system(speak_direction.chain(error_handler))
|
||||
.add_system(add_speed)
|
||||
.add_system_to_stage(CoreStage::PostUpdate, remove_speed);
|
||||
const MOVEMENT_CONTROLS: &str = "MOVEMENT_CONTROLS";
|
||||
if config.movement_control_states.is_empty() {
|
||||
app.add_system(movement_controls::<S, A>.label(MOVEMENT_CONTROLS))
|
||||
.add_system(snap::<S, A>.chain(error_handler).before(MOVEMENT_CONTROLS));
|
||||
.add_system(
|
||||
snap::<S, A>
|
||||
.chain(error_handler)
|
||||
.label(SNAP)
|
||||
.before(MOVEMENT_CONTROLS),
|
||||
);
|
||||
} else {
|
||||
let states = config.movement_control_states;
|
||||
for state in states {
|
||||
app.add_system_set(
|
||||
SystemSet::on_update(state)
|
||||
.with_system(movement_controls::<S, A>.label(MOVEMENT_CONTROLS))
|
||||
.with_system(snap::<S, A>.chain(error_handler).before(MOVEMENT_CONTROLS)),
|
||||
.with_system(
|
||||
snap::<S, A>
|
||||
.chain(error_handler)
|
||||
.label(SNAP)
|
||||
.before(MOVEMENT_CONTROLS),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user