public BaseDisposableListener <E, A> DisposeOn <T>(UnityEvent <T> other) { var listener = other.AddSingleFireListener(delegate { Dispose(); }); onDispose.AddListener(() => other.RemoveListener(listener)); return(this); }
public BaseDisposableListener <E, A> DisposeOnIf <T>(UnityEvent <T> other, Predicate <T> predicate) { var listener = other.AddSingleFireListener(delegate(T arg0) { if (predicate(arg0)) { Dispose(); } }); onDispose.AddListener(() => other.RemoveListener(listener)); return(this); }
public BaseDisposableListener <E, A> DisposeOnIf(UnityEvent other, Func <bool> predicate) { var listener = other.AddSingleFireListener(delegate { if (predicate()) { Dispose(); } }); onDispose.AddListener(() => other.RemoveListener(listener)); return(this); }
public BaseDisposableListener <E, A> DisposeOn(UnityEvent other) { other.AddSingleFireListener(Dispose); onDispose.AddListener(() => other.RemoveListener(Dispose)); return(this); }