pub struct Hero {
pub state: HeroState,
/* private fields */
}Fields§
§state: HeroStateImplementations§
Source§impl Hero
impl Hero
pub const MAX_SPEED: u64 = 8
pub const MAX_VISION: usize = 8
pub const INITIAL_SPEED: u64 = 4
pub const INITIAL_VISION: usize = 1
pub const INITIAL_MEMORY: u64 = 0
pub fn new(id: PlayerId, name: String, position: Position) -> Self
pub fn reset(&mut self, position: Position)
pub fn cycle_ui_options(&mut self)
pub fn is_dead(&self) -> bool
pub fn has_won(&self) -> Option<Duration>
pub fn memory(&self) -> u64
pub fn elapsed_duration_from_start(&self) -> Duration
pub fn can_move(&self) -> bool
pub fn past_visibility_duration(&self) -> Duration
pub fn update_past_visible_positions( &mut self, visible_positions: HashSet<Position>, )
pub fn past_visible_positions(&self) -> &HashMap<Position, Instant>
pub fn set_direction(&mut self, direction: Direction)
pub fn set_position(&mut self, position: Position)
pub fn set_maze_id(&mut self, maze_id: usize)
pub fn decrease_vision(&mut self)
pub fn apply_random_power_up_at_position(&mut self, position: Position)
pub fn power_ups_collected_in_maze(&self, maze_id: usize) -> usize
pub fn power_up_collected_at(&self, maze_id: usize, position: Position) -> bool
Trait Implementations§
Source§impl Entity for Hero
impl Entity for Hero
fn id(&self) -> PlayerId
fn name(&self) -> &str
fn vision(&self) -> usize
fn speed(&self) -> u64
fn position(&self) -> Position
fn direction(&self) -> Direction
fn maze_id(&self) -> usize
fn view(&self) -> View
fn movement_recovery_duration(&self) -> Duration
Auto Trait Implementations§
impl Freeze for Hero
impl RefUnwindSafe for Hero
impl Send for Hero
impl Sync for Hero
impl Unpin for Hero
impl UnsafeUnpin for Hero
impl UnwindSafe for Hero
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> 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