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.

24 lines
497B

  1. using System;
  2. namespace Svelto.ECS
  3. {
  4. public class DispatchOnChange<T> : DispatchOnSet<T> where T:IEquatable<T>
  5. {
  6. public DispatchOnChange(EGID senderID, T initialValue = default(T)) : base(senderID)
  7. {
  8. _value = initialValue;
  9. }
  10. public new T value
  11. {
  12. set
  13. {
  14. if (value.Equals(_value) == false)
  15. base.value = value;
  16. }
  17. get => _value;
  18. }
  19. }
  20. }