예제 #1
0
        public IReferenceBatchAccessor <T1, T2> GetReferenceAccessorFor <T1, T2>(IObservableGroup observableGroup)
            where T1 : class, IComponent
            where T2 : class, IComponent
        {
            var componentTypes = ComponentTypeLookup.GetComponentTypes(typeof(T1), typeof(T2));
            var token          = new AccessorToken(componentTypes, observableGroup);

            if (BatchAccessors.ContainsKey(token))
            {
                return((IReferenceBatchAccessor <T1, T2>)BatchAccessors[token]);
            }

            var batchBuilder  = ReferenceBatchBuilderFactory.Create <T1, T2>();
            var batchAccessor = new ReferenceBatchAccessor <T1, T2>(observableGroup, ComponentDatabase, batchBuilder, ComponentTypeLookup);

            BatchAccessors.Add(token, batchAccessor);

            return(batchAccessor);
        }
예제 #2
0
        public IBatchAccessor <T1, T2, T3> GetAccessorFor <T1, T2, T3>(IObservableGroup observableGroup)
            where T1 : unmanaged, IComponent
            where T2 : unmanaged, IComponent
            where T3 : unmanaged, IComponent
        {
            var componentTypes = ComponentTypeLookup.GetComponentTypes(typeof(T1), typeof(T2), typeof(T3));
            var token          = new AccessorToken(componentTypes, observableGroup);

            if (BatchAccessors.ContainsKey(token))
            {
                return((IBatchAccessor <T1, T2, T3>)BatchAccessors[token]);
            }

            var batchBuilder  = BatchBuilderFactory.Create <T1, T2, T3>();
            var batchAccessor = new BatchAccessor <T1, T2, T3>(observableGroup, ComponentDatabase, batchBuilder, ComponentTypeLookup);

            BatchAccessors.Add(token, batchAccessor);

            return(batchAccessor);
        }
예제 #3
0
        public void RemoveComponents(params Type[] componentTypes)
        {
            var componentTypeIds = ComponentTypeLookup.GetComponentTypes(componentTypes);

            RemoveComponents(componentTypeIds);
        }