Is there a reason why we don't use events?

Something like public event EventHandler CharacterDied; and then CharacterDied?.Invoke(this, e); with a listener in ActionScheduler.

Would be suitable for and intermediate course, not?

2 Likes

We actually do use events and delegats, starting in the Character Stats section, with the lecture “Delegats and Actions for levelling up”. While we don’t directly address the best practice changes to make to the Health component and interacting with it, we give you the tools you need to to know to go back and use them here.

In this course, we don’t use the EventHandler delegate that was introduced in the Turn Based Strategy course, opting at first to use our own defined delegates (to better understand how they work), and then Actions and UnityEvents. This doesn’t mean, however, that if you understand events and the EventHandler (which I now personally prefer), that you can’t go ahead and use them.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms