Struct valence_entity::attributes::EntityAttributes
source · pub struct EntityAttributes { /* private fields */ }
Expand description
The attributes of a Living Entity.
Implementations§
source§impl EntityAttributes
impl EntityAttributes
sourcepub fn get(
&self,
attribute: EntityAttribute,
) -> Option<&EntityAttributeInstance>
pub fn get( &self, attribute: EntityAttribute, ) -> Option<&EntityAttributeInstance>
Gets the instance of an attribute.
sourcepub fn get_base_value(&self, attribute: EntityAttribute) -> Option<f64>
pub fn get_base_value(&self, attribute: EntityAttribute) -> Option<f64>
Gets the base value of an attribute.
Returns None
if the attribute does not exist.
sourcepub fn get_compute_value(&self, attribute: EntityAttribute) -> Option<f64>
pub fn get_compute_value(&self, attribute: EntityAttribute) -> Option<f64>
Gets the computed value of an attribute.
Returns None
if the attribute does not exist.
sourcepub fn has_attribute(&self, attribute: EntityAttribute) -> bool
pub fn has_attribute(&self, attribute: EntityAttribute) -> bool
Checks if an attribute exists.
sourcepub fn create_attribute(&mut self, attribute: EntityAttribute)
pub fn create_attribute(&mut self, attribute: EntityAttribute)
Creates an attribute if it does not exist.
sourcepub fn set_base_value(&mut self, attribute: EntityAttribute, value: f64)
pub fn set_base_value(&mut self, attribute: EntityAttribute, value: f64)
Sets the base value of an attribute.
sourcepub fn set_add_modifier(
&mut self,
attribute: EntityAttribute,
uuid: Uuid,
modifier: f64,
)
pub fn set_add_modifier( &mut self, attribute: EntityAttribute, uuid: Uuid, modifier: f64, )
Sets an add modifier of an attribute.
sourcepub fn set_multiply_base_modifier(
&mut self,
attribute: EntityAttribute,
uuid: Uuid,
modifier: f64,
)
pub fn set_multiply_base_modifier( &mut self, attribute: EntityAttribute, uuid: Uuid, modifier: f64, )
Sets a multiply base modifier of an attribute.
sourcepub fn set_multiply_total_modifier(
&mut self,
attribute: EntityAttribute,
uuid: Uuid,
modifier: f64,
)
pub fn set_multiply_total_modifier( &mut self, attribute: EntityAttribute, uuid: Uuid, modifier: f64, )
Sets a multiply total modifier of an attribute.
sourcepub fn set_modifier(
&mut self,
attribute: EntityAttribute,
uuid: Uuid,
modifier: f64,
operation: EntityAttributeOperation,
)
pub fn set_modifier( &mut self, attribute: EntityAttribute, uuid: Uuid, modifier: f64, operation: EntityAttributeOperation, )
Sets a value modifier of an attribute based on the operation.
sourcepub fn remove_modifier(&mut self, attribute: EntityAttribute, uuid: Uuid)
pub fn remove_modifier(&mut self, attribute: EntityAttribute, uuid: Uuid)
Removes a modifier of an attribute.
sourcepub fn clear_modifiers(&mut self, attribute: EntityAttribute)
pub fn clear_modifiers(&mut self, attribute: EntityAttribute)
Clears all modifiers of an attribute.
sourcepub fn has_modifier(&self, attribute: EntityAttribute, uuid: Uuid) -> bool
pub fn has_modifier(&self, attribute: EntityAttribute, uuid: Uuid) -> bool
Checks if a modifier exists on an attribute.
sourcepub fn to_properties(&self) -> Vec<AttributeProperty<'_>>
pub fn to_properties(&self) -> Vec<AttributeProperty<'_>>
For internal use only.
Converts to a Vec
of AttributeProperty
s.
Trait Implementations§
source§impl Clone for EntityAttributes
impl Clone for EntityAttributes
source§fn clone(&self) -> EntityAttributes
fn clone(&self) -> EntityAttributes
Returns a copy 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 Component for EntityAttributes
impl Component for EntityAttributes
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.
§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
Called when registering this component, allowing mutable access to its [
ComponentHooks
].source§impl Debug for EntityAttributes
impl Debug for EntityAttributes
source§impl Default for EntityAttributes
impl Default for EntityAttributes
source§fn default() -> EntityAttributes
fn default() -> EntityAttributes
Returns the “default value” for a type. Read more
source§impl PartialEq for EntityAttributes
impl PartialEq for EntityAttributes
impl StructuralPartialEq for EntityAttributes
Auto Trait Implementations§
impl Freeze for EntityAttributes
impl RefUnwindSafe for EntityAttributes
impl Send for EntityAttributes
impl Sync for EntityAttributes
impl Unpin for EntityAttributes
impl UnwindSafe for EntityAttributes
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 Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Gets this [
Bundle
]’s component ids. This will be None
if the component has not been registered.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
§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 data from the given [World
].