feat: update to bevy 0.17 and use individual bevy crates
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
use crate::{action_binding::run_action_binding_sugestion, session::OxrSession};
|
||||
use bevy::prelude::*;
|
||||
use bevy_mod_xr::session::XrSessionCreatedEvent;
|
||||
use bevy_app::{App, Plugin, PostUpdate};
|
||||
use bevy_ecs::{message::{Message, MessageReader}, schedule::{IntoScheduleConfigs as _, common_conditions::on_message}, system::Res};
|
||||
use bevy_log::{error, info};
|
||||
use bevy_mod_xr::session::XrSessionCreatedMessage;
|
||||
|
||||
impl Plugin for OxrActionAttachingPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_event::<OxrAttachActionSet>();
|
||||
app.add_message::<OxrAttachActionSet>();
|
||||
app.add_systems(
|
||||
PostUpdate,
|
||||
attach_sets
|
||||
.run_if(on_event::<XrSessionCreatedEvent>)
|
||||
.run_if(on_message::<XrSessionCreatedMessage>)
|
||||
.after(run_action_binding_sugestion),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn attach_sets(session: Res<OxrSession>, mut events: EventReader<OxrAttachActionSet>) {
|
||||
fn attach_sets(session: Res<OxrSession>, mut events: MessageReader<OxrAttachActionSet>) {
|
||||
let sets = events.read().map(|v| &v.0).collect::<Vec<_>>();
|
||||
if sets.is_empty() {
|
||||
return;
|
||||
@@ -36,7 +38,7 @@ fn attach_sets(session: Res<OxrSession>, mut events: EventReader<OxrAttachAction
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Event, Clone)]
|
||||
#[derive(Message, Clone)]
|
||||
/// Send this event for every ActionSet you want to attach to the [`OxrSession`] once the Session Status changed to Ready. all requests will
|
||||
/// be applied in [`PostUpdate`]
|
||||
pub struct OxrAttachActionSet(pub openxr::ActionSet);
|
||||
|
||||
Reference in New Issue
Block a user