Announcement

Collapse
No announcement yet.

Best way to encapsulate and separate view/model/controller type behaviour in blueprints?

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

    Best way to encapsulate and separate view/model/controller type behaviour in blueprints?

    Hey,

    I am new to UE4 and I am trying to get a good grasp of how to work with blueprints.

    I am trying to create a reusable health bar/mana bar type screen component to be shown on the screen. The intention is to easily display the players's health/mana/stamina, as well an enemies. I.e. I want to be able to attach a Resources 'class' to the Player Controller and a Character blueprint type. I want the Resource class to have a constructor, store data, and handle all the UI aspects of handling resources.

    What I currently have is in my FirstPersonCharacter class I store the data of the resource (health, mana, stamina values), with the FirstPersonCharacter class handling changing those values with functions in the class (taking damage, regeneration based off of event ticks, etc.), and the FirstPersonCharacter class handling updating the UI. But now I want a reusable class to do that for me, which I just construct in the FirstPersonCharacter class and route events to, so I can share it amongst non-player characters as well. Essentially moving out all the resource logic from the FirstPersonCharacter class into the Resource class.

    Should I use an ActorComponent? From what I looked at it seemed a bit too excessive for what I am trying to do.

    What is the best way to do this?
Working...
X