Entity component system using a finite state machine