pub enum LevelSelection {
Identifier(String),
Indices(LevelIndices),
Iid(LevelIid),
Uid(i32),
}
Expand description
Resource
for choosing which level(s) to spawn.
For more explanation and comparison of options for selecting levels to spawn, see the
Level Selection
chapter of the bevy_ecs_ldtk
book.
Variants§
Identifier(String)
Spawn level with the given identifier.
Indices(LevelIndices)
Spawn level from its indices in the LDtk file’s worlds/levels.
Iid(LevelIid)
Spawn level with the given level iid
.
Uid(i32)
Spawn level with the given level uid
.
Implementations§
Source§impl LevelSelection
impl LevelSelection
Sourcepub fn iid(iid: impl Into<String>) -> Self
pub fn iid(iid: impl Into<String>) -> Self
Construct a LevelSelection::Iid
using the given iid.
This iid only needs to implement Into<String>
.
§Example
use bevy_ecs_ldtk::prelude::*;
let level_selection = LevelSelection::iid("333081f6-7ac1-4fe3-bdcc-fa3704073bbe");
Sourcepub fn index(level_index: usize) -> Self
pub fn index(level_index: usize) -> Self
Construct a LevelSelection::Indices
using the given level index.
This will point to the level with the given index in the project root.
If you have a multi-worlds project, you should use LevelSelection::indices
instead.
§Example
use bevy_ecs_ldtk::prelude::*;
let level_selection = LevelSelection::index(3);
assert_eq!(level_selection, LevelSelection::Indices(LevelIndices::in_root(3)));
Sourcepub fn indices(world_index: usize, level_index: usize) -> Self
pub fn indices(world_index: usize, level_index: usize) -> Self
Construct a LevelSelection::Indices
using the given world and level indices.
This will point to the level with the given world+level indices in the project worlds.
If your project isn’t multi-worlds, you should use LevelSelection::index
instead.
§Example
use bevy_ecs_ldtk::prelude::*;
let level_selection = LevelSelection::indices(1, 2);
assert_eq!(level_selection, LevelSelection::Indices(LevelIndices::in_world(1, 2)));
Sourcepub fn is_match(&self, indices: &LevelIndices, level: &Level) -> bool
pub fn is_match(&self, indices: &LevelIndices, level: &Level) -> bool
Returns true if the given level matches this LevelSelection
.
Since levels don’t inherently store their index, it needs to be provided separately.
Trait Implementations§
Source§impl Clone for LevelSelection
impl Clone for LevelSelection
Source§fn clone(&self) -> LevelSelection
fn clone(&self) -> LevelSelection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for LevelSelection
impl Debug for LevelSelection
Source§impl Default for LevelSelection
impl Default for LevelSelection
Source§impl PartialEq for LevelSelection
impl PartialEq for LevelSelection
impl Eq for LevelSelection
impl Resource for LevelSelection
impl StructuralPartialEq for LevelSelection
Auto Trait Implementations§
impl Freeze for LevelSelection
impl RefUnwindSafe for LevelSelection
impl Send for LevelSelection
impl Sync for LevelSelection
impl Unpin for LevelSelection
impl UnwindSafe for LevelSelection
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more