In programming, especially in game dev, states are an important concept to manage what’s going on at any given time and what to do next. So we need a finite state machine or ‘FSM’ to manage such things. Basically the state is a data object that can only ever have one value from a finite list of values.
Following the excellent tutorial from Aleksandr Hovhannisyan I’ve made a simple FSM to model a light with three luminosity intensities.
Next steps will be to adapt this to a game, and in particular the Graveyard Shift game I’m working on right now. Here’s a preview of the model that will be setup in the code: