pub struct EnemyState {
id: EnemyIdx,
health_model: HealthModel,
active: bool,
alive: bool,
current_health: f64,
current_transform: SpatialTransform,
movement: EnemyMovementState,
spawned_at: Option<SimTime>,
despawned_at: Option<SimTime>,
died_at: Option<SimTime>,
activation_generation: u64,
}Expand description
Mutable state for one immutable EnemyIdx.
Fields§
§id: EnemyIdx§health_model: HealthModel§active: bool§alive: bool§current_health: f64§current_transform: SpatialTransform§movement: EnemyMovementState§spawned_at: Option<SimTime>§despawned_at: Option<SimTime>§died_at: Option<SimTime>§activation_generation: u64Implementations§
Source§impl EnemyState
impl EnemyState
pub fn from_definition(definition: &EnemyActorDefinition) -> Self
pub const fn id(&self) -> EnemyIdx
pub const fn is_active(&self) -> bool
pub const fn is_alive(&self) -> bool
pub const fn current_health(&self) -> f64
pub const fn current_transform(&self) -> SpatialTransform
pub const fn movement(&self) -> EnemyMovementState
pub const fn spawned_at(&self) -> Option<SimTime>
pub const fn despawned_at(&self) -> Option<SimTime>
pub const fn died_at(&self) -> Option<SimTime>
pub const fn activation_generation(&self) -> u64
pub fn activate(&mut self, at: SimTime) -> bool
pub fn despawn(&mut self, at: SimTime) -> bool
pub fn commit_relocation(&mut self, transform: SpatialTransform)
pub fn apply_damage(&mut self, amount: f64, at: SimTime) -> Option<BecameDead>
pub fn refresh_scripted_health(&mut self, now: SimTime)
pub fn finalize_scripted_death(&mut self, at: SimTime) -> bool
pub fn time_to_die(&self, now: SimTime) -> Option<f64>
Trait Implementations§
Source§impl Clone for EnemyState
impl Clone for EnemyState
Source§fn clone(&self) -> EnemyState
fn clone(&self) -> EnemyState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnemyState
impl Debug for EnemyState
Source§impl PartialEq for EnemyState
impl PartialEq for EnemyState
impl StructuralPartialEq for EnemyState
Auto Trait Implementations§
impl Freeze for EnemyState
impl RefUnwindSafe for EnemyState
impl Send for EnemyState
impl Sync for EnemyState
impl Unpin for EnemyState
impl UnsafeUnpin for EnemyState
impl UnwindSafe for EnemyState
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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