In this chapter, we were able to leverage the State pattern to define and implement stateful behaviors of our main character. In our case, the character is a vehicle. After reviewing its structure in the context of a specific code example, we saw its limits when dealing with animated entities. However, Unity offers us a native solution that permits us to manage the states of animated characters with a sophisticated state machine and a visual editor.
However, it doesn't mean that the State pattern in itself is useless in Unity. We could easily use it as a foundation to build stateful systems or mechanics.
In the next chapter, we will define the global states of our racing game and manage them with Event Bus.