Currently I have many components I use that need to interact with each other based on information generated in them. Is it better to cast and pass the information or do event dispatchers work well too? For example, I have an experience system, that I have use an event dispatcher that talks to 2 different widgets to update information, my character component and my achievement component. Doing it this way seems cleaner as its just one call that hits them all rather than casting a bunch of times but I could just be doing everything in a super inefficient manner. Any advice would be appreciated.
Modifying / Storing experience should be contained in one class. This class can launch an event dispatcher when modifying it.
Other classes can bind some events to it. It seems like the good call to me.
Yeah it’s definitely stored in the experience component, but I have it announce when things change via event dispatcher so that if it hits certain landmarks like 100k experience, you get an achievement unlock. I’m glad to hear I was on the right path, I just wanted to check since I wasn’t too sure