pub struct EntityAttributeInstance { /* private fields */ }Expand description
An instance of an Entity Attribute.
Implementations§
Source§impl EntityAttributeInstance
impl EntityAttributeInstance
Sourcepub fn new(attribute: EntityAttribute) -> Self
pub fn new(attribute: EntityAttribute) -> Self
Creates a new instance of an Entity Attribute.
Sourcepub fn new_with_value(attribute: EntityAttribute, base_value: f64) -> Self
pub fn new_with_value(attribute: EntityAttribute, base_value: f64) -> Self
Creates a new instance of an Entity Attribute with a value.
Sourcepub fn attribute(&self) -> EntityAttribute
pub fn attribute(&self) -> EntityAttribute
Gets the attribute.
Sourcepub fn base_value(&self) -> f64
pub fn base_value(&self) -> f64
Gets the base value of the attribute.
Sourcepub fn compute_value(&self) -> f64
pub fn compute_value(&self) -> f64
Gets the computed value of the attribute.
Sourcepub fn with_add_modifier(&mut self, id: &str, modifier: f64) -> &mut Self
pub fn with_add_modifier(&mut self, id: &str, modifier: f64) -> &mut Self
Sets an add modifier.
If the modifier already exists, it will be overwritten.
Returns a mutable reference to self.
Sourcepub fn with_multiply_base_modifier(
&mut self,
id: &str,
modifier: f64,
) -> &mut Self
pub fn with_multiply_base_modifier( &mut self, id: &str, modifier: f64, ) -> &mut Self
Sets a multiply base modifier.
If the modifier already exists, it will be overwritten.
Returns a mutable reference to self.
Sourcepub fn with_multiply_total_modifier(
&mut self,
id: &str,
modifier: f64,
) -> &mut Self
pub fn with_multiply_total_modifier( &mut self, id: &str, modifier: f64, ) -> &mut Self
Sets a multiply total modifier.
If the modifier already exists, it will be overwritten.
Returns a mutable reference to self.
Sourcepub fn with_modifier(
&mut self,
id: &str,
modifier: f64,
operation: EntityAttributeOperation,
) -> &mut Self
pub fn with_modifier( &mut self, id: &str, modifier: f64, operation: EntityAttributeOperation, ) -> &mut Self
Sets a value modifier based on the operation.
If the modifier already exists, it will be overwritten.
Returns a mutable reference to self.
Sourcepub fn remove_modifier(&mut self, id: &String)
pub fn remove_modifier(&mut self, id: &String)
Removes a modifier.
Sourcepub fn clear_modifiers(&mut self)
pub fn clear_modifiers(&mut self)
Clears all modifiers.
Sourcepub fn has_modifier(&self, id: &String) -> bool
pub fn has_modifier(&self, id: &String) -> bool
Checks if a modifier exists.
Trait Implementations§
Source§impl Clone for EntityAttributeInstance
impl Clone for EntityAttributeInstance
Source§fn clone(&self) -> EntityAttributeInstance
fn clone(&self) -> EntityAttributeInstance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for EntityAttributeInstance
impl Component for EntityAttributeInstance
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
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<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
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)>
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)>
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)>
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)>
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)>
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,
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 EntityAttributeInstance
impl Debug for EntityAttributeInstance
Source§impl PartialEq for EntityAttributeInstance
impl PartialEq for EntityAttributeInstance
Source§fn eq(&self, other: &EntityAttributeInstance) -> bool
fn eq(&self, other: &EntityAttributeInstance) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for EntityAttributeInstance
Auto Trait Implementations§
impl Freeze for EntityAttributeInstance
impl RefUnwindSafe for EntityAttributeInstance
impl Send for EntityAttributeInstance
impl Sync for EntityAttributeInstance
impl Unpin for EntityAttributeInstance
impl UnsafeUnpin for EntityAttributeInstance
impl UnwindSafe for EntityAttributeInstance
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
§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>>
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,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.