//T1 public virtual void Subscribe <T>(T _object, Action <T> _callback) where T : class { T1MatchCache.Clear(); T1MatchCache = GetMatch(_object, out int ind); if (T1MatchCache.IsEmpty) { T1MatchCache.objectValue = _object; T1MatchCache.action = arg => _callback(arg as T); T1Callbacks.Add(T1MatchCache.Copy()); } }
public void UnSubscribe <T>(T _object, System.Action <T> _onFinishedCallback) where T : class { T1Cache.Clear(); T1Cache = GetMatch(_object, out int ind); if (!T1Cache.IsEmpty) { finishedCallbacks.RemoveAt(ind); } //unsub from condition as well finishedCondition.UnSubscribe(OnFinished); }