Exemple #1
0
        public ulong Add(EntityId entityId, Action <T> callback)
        {
            if (!indexedCallbacks.TryGetValue(entityId, out var callbacks))
            {
                callbacks = new CallbackCollection <T>();
                indexedCallbacks.Add(entityId, callbacks);
            }

            lastCallbackKey++;
            callbackKeyToEntityId.Add(lastCallbackKey, entityId);
            callbacks.Add(lastCallbackKey, callback);
            return(lastCallbackKey);
        }