pub struct Tile { /* private fields */ }
Expand description
A single cell in the grid.
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn new(x: usize, y: usize, terrain: Terrain) -> Self
pub fn new(x: usize, y: usize, terrain: Terrain) -> Self
Create a new tile at (x, y)
with the given terrain.
Sourcepub fn is_walkable(self) -> bool
pub fn is_walkable(self) -> bool
Whether this tile can be traversed.
Sourcepub fn is_occupied(self) -> bool
pub fn is_occupied(self) -> bool
Whether the tile currently contains the unit.
Sourcepub fn place_unit(&mut self, unit: Unit)
pub fn place_unit(&mut self, unit: Unit)
Place the unit on this tile.
Sourcepub fn remove_unit(&mut self)
pub fn remove_unit(&mut self)
Remove the unit from this tile, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
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,
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 more