The enemies have been a struggle since the beginning, with a script that kept growing in size, the bugs kept appearing whenever something was changed.
Therefor, Brecht, Nick and I have been sitting together to rework the entire script. It has now been divided into smaller scripts that define the behaviour of the enemy, depending on its type (i.e. Ranged or Melee, Shield or no Shield, Patrol or Guard). This increases maintainability and readability by a lot, and writing the script from scratch gave us more insight in where each bug might be coming from.
Since there are 3 enemy models, each with 3 possible weapons, and the option to have a shield, creating a prefab for each type would clutter our prefab list. Therefor, I’ve created a script which allows us to easily generate a different enemy model in edit mode.