Final Game and Conclusion
What I Built and How I Did It
Throughout the development process, I got to work across nearly every Unity system:
-
Scripting: I wrote dozens of custom scripts using to manage weapons, enemies, player controls, pickups, and more. I also used coroutines for actions like rolling invulnerability or UI transitions, and relied on Unity events to communicate between systems (like triggering win conditions when all enemies are dead).
-
Input & Vectors: I implemented the new Input System, allowing for both keyboard and arcade stick integration. Movement and aiming are handled using vectors to rotate the player or calculate bullet direction with precision.
-
Physics: All movement and combat use Unity’s 2D physics engine. I configured rigidbodies, colliders, and triggers to manage everything from bullet impacts to object pushing. Careful layer setup and tag filtering helped prevent unwanted collisions (like enemies accidentally killing each other).
-
Graphics & Audio: I integrated sprites, tilemaps, and audio clips. Guns now have firing sounds, windows make a sound when breaking, and background music (really cool drum and bass). I didn’t go too deep in this part since I was more focused on the core mechanics and left this part for the last minute.
-
Animation: I used Unity’s Animator Controller system to manage the player’s armed/unarmed states, and walking animations. The transitions feel smooth and responsive. Like last section, I didn't focus too much on this part.
-
Game Architecture: This was perhaps the biggest challenge. I restructured the weapon system using a base class (GunBase) and inherited classes for each weapon type. I followed SOLID principles (as much as I could and remembered) to separate responsibilities and prevent code duplication. I also created a central "EnemyManager" to track enemy count, and the system now feels modular and expandable. Adding new guns is easier at this point. I could have done the same for enemies, but I ran out of time and I didn't think about it enough to be honest.
-
Game AI: I built two distinct enemy types (ranged and melee) using finite-state machines. The AI makes use of 2D NavMesh Agents for pathfinding, combined with raycasting to handle line-of-sight logic. They behave intelligently: ranged units only shoot when they can see you, melee enemies chase you down, and they all stop targeting if you escape the room.
-
User Interface: Finally, I built all the necessary UI elements: a Main Menu, Pause Menu, Victory/Defeat screens, and a dynamic HUD that displays ammo and enemy count in real time. It is really simple and not visually attractive to be honest. However, the main focus here is learning how to implement the logic behind it, and the aesthetic will come later.










Comentarios
Publicar un comentario