pub struct MapLevels { /* private fields */ }Expand description
Слоистая геометрия карты без физического мира: гриды уровней, списки
сплошных тайлов, прогоны рамп. Хост держит её внутри GameMap,
клиентская реплика игры строит из полей MAP_DATA — правила уровней у
обеих сторон читаются отсюда и только отсюда.
Implementations§
Source§impl MapLevels
impl MapLevels
Sourcepub fn build(
grid0: &[Vec<i32>],
solid0: &[i32],
levels: &IndexMap<String, MapLevelConfig>,
ramps: &[RampConfig],
tile_size: f32,
) -> Self
pub fn build( grid0: &[Vec<i32>], solid0: &[i32], levels: &IndexMap<String, MapLevelConfig>, ramps: &[RampConfig], tile_size: f32, ) -> Self
grid0/solid0 — грид и стены уровня 0; levels — конфиги
надземных уровней (ключ — номер строкой); ramps — конфиги рамп;
tile_size — УЖЕ масштабированный размер тайла.
Sourcepub fn is_layered(&self) -> bool
pub fn is_layered(&self) -> bool
Есть ли надземные уровни (2.5D-режим).
Sourcepub fn level_count(&self) -> usize
pub fn level_count(&self) -> usize
Число уровней, включая землю (1 у обычной карты).
pub fn tile_size(&self) -> f32
pub fn grid(&self, level: u8) -> Option<&Vec<Vec<i32>>>
pub fn solid(&self, level: u8) -> &[i32]
pub fn floor(&self, level: u8) -> &[i32]
pub fn runs(&self) -> &[RampRun]
Sourcepub fn cell_at(&self, x: f32, y: f32) -> Option<(usize, usize)>
pub fn cell_at(&self, x: f32, y: f32) -> Option<(usize, usize)>
(колонка, строка) по мировой точке; None вне карты.
Sourcepub fn has_floor(&self, level: u8, x: f32, y: f32) -> bool
pub fn has_floor(&self, level: u8, x: f32, y: f32) -> bool
Есть ли пол уровня level в точке. Для уровня 0 — true везде внутри
карты (под мостом земля никуда не девается).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MapLevels
impl<'de> Deserialize<'de> for MapLevels
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MapLevels
impl RefUnwindSafe for MapLevels
impl Send for MapLevels
impl Sync for MapLevels
impl Unpin for MapLevels
impl UnsafeUnpin for MapLevels
impl UnwindSafe for MapLevels
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.