I’m currently on a project and i’m at the point of creating the health system.
I chose to implement health as a component, which i associated with any playable character and the AI.
Problem is, i cannot find a solution when it comes to make (for example) the hero die.
Indeed, i created a boolean variable in the component (bIsDead), but i cannot find anyway to create a death event on call of this variable on the characters which have the component implemented.
So a few questions come to mind :
I could use the event tick to check on the state of the variable, but using the event tick on every single pawn posessing the component in the game is probably not a great idea, for obvious reasons.
I do not want to have to cast a death function in the component to a specific pawn (the blueprint would be enormous)…
I thought about making a function in each character, which would check the value of my variable everytime HP’s are updated, but i cannot find how to call it…
So my questions are : Am i doing something wrong ? Am i missing something ? Would interface be a better choice to manage health and damages ? Would it be wiser to go for inheritance ?
Thanks in advance.