ECS and finite state machine #1230
-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It doesn't depend on EnTT. It's more a matter of tastes when using entities and components. |
Beta Was this translation helpful? Give feedback.
It doesn't depend on EnTT. It's more a matter of tastes when using entities and components.
One way to do that is to define your states as components, attach and remove them as needed, and have different systems for different states.
Otherwise, you can have a component that stores all data along with a state identifier, then use an fsm system to update this state representation.
Of course, you can also have a pointer to a more OOP-ish data structure that gets the job done and stay more on the OOP side.
None of these solutions is more right or more wrong than the others. 🤷♂️