Assume that I want to add something to show the current score of the player in a game. It's natural to create an actor along with a render component and a script for this purpose.
In the components, I would add some logics like:
- Register self to the event dispatcher, listening to something like "PlayerGotScore".
- When triggered by the "PlayerGotScore", get the new score from the event.
- Then update the appearance of the render component according to the new score.
The question is that I don't know where should these logics be. Either the render component or the script seems to be a reasonable place. How to make this decision?
In the components, I would add some logics like:
- Register self to the event dispatcher, listening to something like "PlayerGotScore".
- When triggered by the "PlayerGotScore", get the new score from the event.
- Then update the appearance of the render component according to the new score.
The question is that I don't know where should these logics be. Either the render component or the script seems to be a reasonable place. How to make this decision?