Sorry, I cannot produce an entire step-by-step tutorial that fits right into your existing thing :(. Wish I had the time. There are too many tuts out there that cover this on YT. But the gist is a follows:
Controls are in the player:
The player asks the gun to execute some internal functionality.
-
anything that is related to the gun goes into the gun - ammo in clip, ammo left, reload speed, accuracy, damage, animations, sounds, reloading, firing logic
-
anything that’s related to the player stays in the player - how many guns they carry, total ammo, total weight, health
I’d keep the widget in the player (if you only need one at a time) and have the gun report back its current stats.
