This Script was the controller for the PC (Playable Character) Which allowed Users to move the gameObject and rotate the camera when moving the mouse. I wanted the player to feel free in the environment and for the camera to rotate smoothly to mimic eyes and the movement to be used for a fast-paced FPS experience.
This Script allowed the player to shoot a Ray which allowed for a muzzle flash and an impact particle effect on surfaces. Also Visually showed UI for how much ammo the player has. While having a reload Function when the player’s ammo equalled to nothing
This script allowed the player to scroll through different prefabbed weapons. Scrolling through the children of the gameObject, in this case, the PC. Using the scroll wheel to change weapon back and forwards which declined an int that monitored what weapon was currently active.
This project really gave me a clear base understanding of how an FPS script should look and how raycasts physics worked in Unity3D. It was also one of my first attempts into unity3D for I mainly did projects which involved 2D. I feel in myself I could have continued this project for longer to add more guns instead of a pistol and machine gun. Adding a shotgun with accuracy would have been something else to engage on. However, this project did allow me to learn some basics into an FPS I enjoyed the gunplay mechanics I created, while thinking about what I wanted to achieve I did want the guns to show the ammo and be different to have different types of guns this was my main concept when entering this project and I achieved this effect I was looking for.
If you wish to see the work in action for yourself its located in my GitHub