Przykład działania Unity
public static event Action<string> OnGameOver;
public void TakeDamage(float damage)
{
health -= damage;
if(health < 0)
{
OnGameOver?.Invoke("The game is over");
}
}
// can have multiple paramethers, always return null (if you want that it
// retur something you have to create your own event
public static event Action<string> OnGameOver;
public static event Action<float, bool> OnPlayerHurt;
Jesús Angarita