Crates.io | bevy_attr |
lib.rs | bevy_attr |
version | 0.1.0 |
source | src |
created_at | 2022-11-12 22:35:48.62396 |
updated_at | 2022-11-12 22:38:00.569343 |
description | Automatic management of highly modular, highly parallel values with minimal overhead |
homepage | |
repository | |
max_upload_size | |
id | 713854 |
size | 85,653 |
Automatic management of highly modular, highly parallel values in Bevy with minimal overhead.
bevy version | crate version |
---|---|
0.9.0-dev | 0.1.0-dev |
This crate consists of attributes which are components that contain simple values and modifiers (also components) which automatically edit the values of attributes.
The relationship between the Attribute
and Modifier
traits can be thought of as similar to that between Bevy's GlobalTransform
and Transform
components. Once per frame, any changed, added, or removed modifiers will force a refresh on the attribute in the same entity. All of the modifiers on the entity will be collected and sorted and sequentially re-applied to the default value of the attribute. Although impractical, Transform
could be implemented as a modifier on a GlobalTransform
which copies the data in the Transform
into the GlobalTransform
, but this crate works best with many concurrent modifiers.
In a Bevy app, example uses of attributes could be stat systems where Strength
and Endurance
both implement the Attribute
trait and whose modifiers are updated infrequently, or more dynamic systems where Health
and MaxHealth
implement it. Since both attributes and modifiers are just components, in that example, it may be a good idea to have MaxHealth
be a modifier for Health
.