Enemy Animations


Animating each of the enemies presented an interesting problem. Some enemies like the bird were simple to add in the animations since they only took a few extra lines of code to transition from each of the animations. On the other hand, some enemies were a lot harder, like the plant, which had multiple stages similar to the boss. For these enemies, we took the code that was originally in one script and took advantage of Unity's state machine behaviors built into the animator.

Each animation has a separate script that controls each animation. Each of these then had transitions between each that would be triggered through the code usually based on a singular trigger call or would be based on some set of values that were updated by the code. One issue here would be that there are a few bugs or at least a discrepancy between what the methods are described to do versus what it does. A lot of times, the OnStateExit does not trigger every time you think it would. A lot of that was solved simply by having a second animation that would trigger what we wanted in the OnStateEnter method.