The FSM framework we're going to use here is adapted from the C# FSM framework, which can be found at https://wiki.unity3d.com/index.php?title=Finite_State_Machine. That framework is again a part of the Deterministic Finite State Machine framework, based on Chapter 3.1 of Game Programming Gems 1, by Eric Dybsend. We'll only be looking at the differences between this FSM and the one we made earlier. The complete FSM can be found with the assets that come with the book. We'll now study how the framework works and how we can use it to implement our tank AI.
AdvanceFSM and FSMState are the two main classes of our framework. Let's take a look at them first.