Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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. alt text

(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!

Product Version: UE 4.16
capture.png (159.4 kB)
more ▼

asked Aug 04 '17 at 02:49 AM in Blueprint Scripting

avatar image

27 3 7 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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).

more ▼

answered Aug 04 '17 at 05:52 AM

avatar image

111 2 4 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question