Announcement

Collapse
No announcement yet.

Design Patterns: Getting away from character orchestrating everything?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Design Patterns: Getting away from character orchestrating everything?

    I posted this on the Unreal Answers board but I'd prefer this gets a discussion rather than just an answer.

    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!
    Attached Files
Working...
X