Пример #1
0
        public void UnsubscribeFromEvent <T>(PhysicsEventCallback <T> callback) where T : IPhysicsEventData
        {
            Type t = typeof(T);

            if (!physicsEventCallbacks.TryGetValue(t, out var set))
            {
                return;
            }
            set.Remove(callback);
        }
Пример #2
0
        public void SubscribeToEvent <T>(PhysicsEventCallback <T> callback) where T : IPhysicsEventData
        {
            Type t = typeof(T);

            if (!physicsEventCallbacks.TryGetValue(t, out var set))
            {
                set = new HashSet <Delegate>();
                physicsEventCallbacks.Add(t, set);
            }
            set.Add(callback);
        }