Design Patterns: Getting away from character orchestrating everything?
The title of the question is very open, but I have a specific instance which perfectly meets my criteria. I have my Character which is (probably incorrectly, Controller should likely be responsible) responsible for the input actions for movement and shooting.
I also have a timeline that I wish to use to modify properties of my Weapon class. Currently, because Character has the input actions for pressed/released, I'm "forced" to use the timeline play/stop actions in the Character class and calling getters/setters on the equipped weapon. It works, but it's not single responsible as I would like the Character class to be. I would prefer that the timeline, which modifies Weapon variables, be used in the Weapon class.
How can I efficiently delegate pressed/released actions from the Character, to start/stop the timeline in the Weapon class? I don't want my Character to become a master delegate/GOD class and I'm trying to be as SOLID as possible with the design.
(Attached image is inside Character class and Play/Stop are executing from Fire Pressed/Released. It seems less computationally expensive to have this functionality in the Weapon class...)
And any other object oriented design patterns you want to include are much appreciated!
asked Aug 04 '17 at 02:49 AM in Blueprint Scripting
You could call functions implemented within the weapon class, or make the weapon bind its functions to the character's OnFirePressed and OnFireReleased events (that you would have to broadcast instead of directly calling the functions).
answered Aug 04 '17 at 05:52 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here