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); }
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); }