Enemy AIs, UI logic and Adjusting Weapons Architecture
NavMesh 2D, Changing Weapon's Architecture, and Implementing first UI For this blog post, I started by cleaning up the weapon system, then gave the enemies some actual AI, and implemented a Pause Menu. A Cleaner Way to Handle Guns At first, the weapons were just hardcoded actions. One script, one gun. But that wouldn’t scale, and it was starting to get messy. I was having some other problems as well, specially when grabbing and dropping the gun, because (for some reason), clones of the GameObject were being created instead of using the original. So I decided to restructure it using an abstract class called "GunBase". Every weapon now inherits from it and implements its own "Shoot()" method and other characteristics a weapon has (ammo, icon, audio, etc). For example, the pistol and machine gun now share the same structure but behave differently (semi-auto vs. full-auto). There’s also built-in logic for ammo, bullet speed, and reloading. This approach makes i...