I’m attempting to use an OOP approach in order to create a weapon. I have created a main BaseClass for a weapon and inside the base class, there are other classes that are in charge of stuff like projectiles and etc.
I’m trying to create a class that handles the audio components of a gun, which is in charge of playing a sound when actions such as firing, reloading, or when a target is hit.
However, one class is in charge of the projectiles (which will determine if the target has been hit) and another class is in charge of reloading, and etc. My problem is, how do I make it so that the same Audio class object can only be accessed by multiple classes with the base class?
If anyone have any tips on how to organize stuff in OOP of if I’m doing something wrong, please tell me.