2D Gun Controller with Accuracy and Recoil Logic is an all in one gun controller script that allows you to easily make every gun in your game behave exactly as you imagined it.
This asset controls the following actions out of the box:
- Watching for input.
- Calculating bullet trajectory based on customizable recoil and accuracy traits.
- Sending ray casts and monitoring hits.
- Instantiating bullet prefabs.
- Instantiating muzzle flash prefabs.
- Reloading and monitoring ammo.
- and much more.
This controller provides 19 customizable traits that allow you to make each gun completely unique.
These traits allow you to customize each guns:
- Recoil.
- Accuracy.
- Fire rate.
- Fire type (semi-automatic, burst, or automatic).
- Magazine sizes.
- Maximum ammo.
- Reloading time.
- Damage.
This asset as designed to be easy to use and setup, as well as being straight forward to add more functionality to be it, like triggering animations for firing and reloading.
All scripts within this asset are heavily documented with the intention of assisting users with customizing the code if they choose to.