add player spawn oneshot
This commit is contained in:
parent
a24e6e39a6
commit
f7f50a1b54
1 changed files with 13 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
use std::{hash::Hash, time::Duration};
|
use std::{hash::Hash, time::Duration};
|
||||||
|
|
||||||
use animation::AnimBundle;
|
use animation::AnimBundle;
|
||||||
use bevy::{prelude::*, sprite::MaterialMesh2dBundle, utils::HashMap};
|
use bevy::{ecs::system::SystemId, prelude::*, sprite::MaterialMesh2dBundle, utils::HashMap};
|
||||||
|
|
||||||
use bevy_rapier2d::prelude::*;
|
use bevy_rapier2d::prelude::*;
|
||||||
|
|
||||||
|
@ -14,8 +14,18 @@ mod animation;
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
struct Player;
|
struct Player;
|
||||||
|
|
||||||
pub(super) fn player_plugin(app: &mut App) {
|
#[derive(Resource)]
|
||||||
app.add_systems(OnEnter(AppState::InGame), add_player.in_set(IngameSet));
|
struct PlayerSpawnOneshot(SystemId);
|
||||||
|
|
||||||
|
impl FromWorld for PlayerSpawnOneshot {
|
||||||
|
fn from_world(world: &mut World) -> Self {
|
||||||
|
Self(world.register_system(add_player))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn plyer_plugin(app: &mut App) {
|
||||||
|
app.add_systems(OnEnter(AppState::InGame), add_player.in_set(IngameSet))
|
||||||
|
.init_resource::<PlayerSpawnOneshot>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component, Hash, PartialEq, Eq, Default)]
|
#[derive(Component, Hash, PartialEq, Eq, Default)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue