系统集

系统集允许你轻松地将共同的属性应用于多个系统,以达到诸如标签排序执行条件状态等目的。

    fn main() {
        App::new()
            .add_plugins(DefaultPlugins)

            // group our input handling systems into a set
            .add_system_set(
                SystemSet::new()
                    .label("input")
                    .with_system(keyboard_input)
                    .with_system(gamepad_input)
            )

            // our "net" systems should run before "input"
            .add_system_set(
                SystemSet::new()
                    .label("net")
                    .before("input")
                    // individual systems can still have
                    // their own labels (and ordering)
                    .with_system(server_session.label("session"))
                    .with_system(server_updates.after("session"))
            )

            // some ungrouped systems
            .add_system(player_movement.after("input"))
            .add_system(session_ui.after("session"))
            .add_system(smoke_particles)

            .run();
    }