예제 #1
0
        public V GetObserver <V>() where V : IObserveComponent <T>
        {
            if (!isInitialized)
            {
                Debug.LogAssertion(NotYetObservingMessage);
            }

            return((V)Observers.FirstOrDefault(c => c is V));
        }
예제 #2
0
        public void CloseObserver(ObserverDefinition definition)
        {
            ObserverHandle handle = Observers.FirstOrDefault(observerForm => Equals(observerForm.Observer.Definition, definition));

            if (handle == null)
            {
                Log.Warn("Observer with {@definition} not found, cannot close", definition);
                return;
            }

            handle.Dispose();
            Observers.Remove(handle);

            RefreshObserverRequests();
        }