Checking enemy death

What would be the best way to check if an enemy has died?

The way i did it was checking if the health <= 0 if this was true i would set a bool to true and this seems like a terrible way of doing it.

	if (EnemyHealth <= 0.0f) {
		bEnemyIsDead = true;

What other ways could i do this also how would i be able to check if two enemies (Or more) died?

Back to the way i did it see what i mean by a terrible way if i used a bool it would only count that i had killed one of the two enemies.

I would personally use Event Dispatcher for this purpose. Make an object that should check if enemy has died as a listener and enemy instances as talkers.

if (this->Health <= 0.0f)

would be triggered enemy should call an event dispatcher and listener would have an reference to died enemy.

Would you be able to give me an example for the event dispatchers/listeners i haven’t used them before so im not sure how i would use them. Thanks.

want much more examples…its useful :)](

Event Dispatcher seems to be the Blueprint version of delegates.


Related thread with code examples: