Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
649B

  1. public class Dispatcher<S, T>
  2. {
  3. public event System.Action<S, T> subscribers;
  4. private Dispatcher() { }
  5. public Dispatcher(S sender)
  6. {
  7. _sender = sender;
  8. }
  9. public void Dispatch(ref T value)
  10. {
  11. if (subscribers != null)
  12. subscribers(_sender, value);
  13. }
  14. readonly S _sender;
  15. }
  16. public class Dispatcher<S>
  17. {
  18. public event System.Action<S> subscribers;
  19. private Dispatcher() { }
  20. public Dispatcher(S sender)
  21. {
  22. _sender = sender;
  23. }
  24. public void Dispatch()
  25. {
  26. if (subscribers != null)
  27. subscribers(_sender);
  28. }
  29. readonly S _sender;
  30. }