#One time actions in ECS

1 messages · Page 1 of 1 (latest)

junior mesa
#

Hello, I have a question. How do you handle "one-time" actions with DOTS ECS.

For example I want to have an upgrade system where I increase the level of a building after a user clicks a button.

Right now I have
The user clicks a button -> an AugmentLevel component is added to the targeted entity -> a system increments the level of the building by a given amount -> and another system cleans up the AugmentLevel component

but this seems so incredibly over engineered especially when I increment/adjust values of many different types (levels, resources, etc.)

Is there a better way to handle this in an ECS style?

blissful gale
#

Technically adding component IS ecs way (but not necessarily to target entity, because it has limitation of 1 action at a time), but DOTS favors approaches without structural changes.
So better alternative (for this specific one) would be - write to some singleton buffer (or just singleton component with native list field) data about which entity needs level up.
Then some system would read that buffer, make level ups and clear it.