Exemple #1
0
        public BaseDisposableListener <E, A> DisposeOn <T>(UnityEvent <T> other)
        {
            var listener = other.AddSingleFireListener(delegate { Dispose(); });

            onDispose.AddListener(() => other.RemoveListener(listener));
            return(this);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public BaseDisposableListener <E, A> DisposeOn(UnityEvent other)
 {
     other.AddSingleFireListener(Dispose);
     onDispose.AddListener(() => other.RemoveListener(Dispose));
     return(this);
 }