pub struct ActiveStatusEffects { /* private fields */ }Expand description
[Component] that stores the ActiveStatusEffects of an [Entity].
Implementations§
Source§impl ActiveStatusEffects
impl ActiveStatusEffects
Sourcepub fn apply(&mut self, effect: ActiveStatusEffect)
pub fn apply(&mut self, effect: ActiveStatusEffect)
Applies a new ActiveStatusEffect.
If the ActiveStatusEffect is already active:
- if the new effect is the same as the old one and its duration is longer, it replaces the old effect. Otherwise, it does nothing.
- if the new effect is stronger than the old one:
- if the new effect’s duration is longer, it replaces the old effect.
- if the new effect’s duration is shorter, it overrides the old
- if the new effect is weaker than the old one and if the new effect’s duration is longer, it will be overridden by the old effect until the old effect’s duration is over.
Sourcepub fn replace(&mut self, effect: ActiveStatusEffect)
pub fn replace(&mut self, effect: ActiveStatusEffect)
Replace an existing ActiveStatusEffect.
Sourcepub fn remove(&mut self, effect: StatusEffect)
pub fn remove(&mut self, effect: StatusEffect)
Removes an ActiveStatusEffect.
Sourcepub fn remove_all(&mut self)
pub fn remove_all(&mut self)
Removes all ActiveStatusEffects.
Sourcepub fn no_effect(&self, effect: StatusEffect) -> bool
pub fn no_effect(&self, effect: StatusEffect) -> bool
Returns true if there are no effects of the given type.
Sourcepub fn has_effect(&self, effect: StatusEffect) -> bool
pub fn has_effect(&self, effect: StatusEffect) -> bool
Returns true if there is an effect of the given type.
Sourcepub fn no_effects(&self) -> bool
pub fn no_effects(&self) -> bool
Returns true if there are no effects.
Sourcepub fn has_effects(&self) -> bool
pub fn has_effects(&self) -> bool
Returns true if there are any effects.
Sourcepub fn max_duration(&self, effect: StatusEffect) -> DurationResult
pub fn max_duration(&self, effect: StatusEffect) -> DurationResult
Returns the maximum duration of the given effect.
Sourcepub fn get_current_effect(
&self,
effect: StatusEffect,
) -> Option<&ActiveStatusEffect>
pub fn get_current_effect( &self, effect: StatusEffect, ) -> Option<&ActiveStatusEffect>
Gets the current effect of the given type.
Sourcepub fn get_all_effect(
&self,
effect: StatusEffect,
) -> Option<&Vec<ActiveStatusEffect>>
pub fn get_all_effect( &self, effect: StatusEffect, ) -> Option<&Vec<ActiveStatusEffect>>
Gets all the effects of the given type.
Sourcepub fn get_current_effects(&self) -> Vec<&ActiveStatusEffect>
pub fn get_current_effects(&self) -> Vec<&ActiveStatusEffect>
Gets all the current effects.
Sourcepub fn get_all_effects(
&self,
) -> &IndexMap<StatusEffect, Vec<ActiveStatusEffect>>
pub fn get_all_effects( &self, ) -> &IndexMap<StatusEffect, Vec<ActiveStatusEffect>>
Gets all the effects.
Trait Implementations§
Source§impl Component for ActiveStatusEffects
impl Component for ActiveStatusEffects
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
A constant indicating the storage type used for this component.
Source§type Mutability = Mutable
type Mutability = Mutable
A marker type to assist Bevy with determining if this component is
mutable, or immutable. Mutable components will have [
Component<Mutability = Mutable>],
while immutable components will instead have [Component<Mutability = Immutable>]. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Registers required components. Read more
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
Returns [
ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Gets the
on_add [ComponentHook] for this [Component] if one is defined.§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Gets the
on_insert [ComponentHook] for this [Component] if one is defined.§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Gets the
on_discard [ComponentHook] for this [Component] if one is defined.§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Gets the
on_remove [ComponentHook] for this [Component] if one is defined.§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Gets the
on_despawn [ComponentHook] for this [Component] if one is defined.§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
Maps the entities on this component using the given [
EntityMapper]. This is used to remap entities in contexts like scenes and entity cloning.
When deriving [Component], this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for ActiveStatusEffects
impl Debug for ActiveStatusEffects
Source§impl Default for ActiveStatusEffects
impl Default for ActiveStatusEffects
Source§fn default() -> ActiveStatusEffects
fn default() -> ActiveStatusEffects
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ActiveStatusEffects
impl RefUnwindSafe for ActiveStatusEffects
impl Send for ActiveStatusEffects
impl Sync for ActiveStatusEffects
impl Unpin for ActiveStatusEffects
impl UnsafeUnpin for ActiveStatusEffects
impl UnwindSafe for ActiveStatusEffects
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
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Return a iterator over this [
Bundle]’s component ids. This will be None if the component has not been registered.§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Moves the components out of the bundle. Read more
§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Applies the after-effects of spawning this bundle. Read more
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§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>
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.