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.

34 lines
617B

  1. using System.Collections.Generic;
  2. public class DispatcherOnChange<S, T>: Dispatcher<S, T>
  3. {
  4. public DispatcherOnChange(S sender) : base(sender) { }
  5. public T value
  6. {
  7. set
  8. {
  9. if (EqualityComparer<T>.Default.Equals(value, _value) == false)
  10. {
  11. _value = value;
  12. Dispatch(ref value);
  13. }
  14. }
  15. }
  16. T _value;
  17. }
  18. public class DispatcherOnSet<S, T>: Dispatcher<S, T>
  19. {
  20. public DispatcherOnSet(S sender) : base(sender) { }
  21. public T value
  22. {
  23. set
  24. {
  25. Dispatch(ref value);
  26. }
  27. }
  28. }