Struct bevy_yoleck::prelude::YoleckLoadLevel
source · pub struct YoleckLoadLevel(pub Handle<YoleckRawLevel>);
Expand description
Command Yoleck to load a level.
fn level_loading_system(
asset_server: Res<AssetServer>,
mut commands: Commands,
) {
commands.spawn(YoleckLoadLevel(asset_server.load("levels/level1.yol")));
}
After the level is loaded, YoleckLoadLevel
will be removed and YoleckKeepLevel
will be
added instead. To unload the level, either remove YoleckKeepLevel
or despawn the entire level
entity.
Immediately after the level is loaded, but before the populate systems get to run, Yoleck will
run the YoleckSchedule::LevelLoaded
schedule, allowing the game to register systems there
and interfere with the level entities while they are still just freshly deserialized
YoleckComponent
data. During that time, the entities of
the levels that were just loaded will be marked with YoleckLevelJustLoaded
, allowing to
these systems to distinguish them from already existing levels.
Note that the entities inside the level will not be children of the level entity. Games that
want to load multiple levels and dynamically position them should use
VpeolRepositionLevel
.
Tuple Fields§
§0: Handle<YoleckRawLevel>
Trait Implementations§
source§impl Component for YoleckLoadLevel
impl Component for YoleckLoadLevel
source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
source§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks
.Auto Trait Implementations§
impl Freeze for YoleckLoadLevel
impl !RefUnwindSafe for YoleckLoadLevel
impl Send for YoleckLoadLevel
impl Sync for YoleckLoadLevel
impl Unpin for YoleckLoadLevel
impl !UnwindSafe for YoleckLoadLevel
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>)
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>) )
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.