Exemplo n.º 1
0
 public EntityFilterCollectionsWithContextEnumerator(NativeDynamicArrayCast <int> getDirectValueByRef,
                                                     SharedSveltoDictionaryNative <long, EntityFilterCollection> sharedSveltoDictionaryNative,
                                                     FilterContextID filterContextId) : this()
 {
     _getDirectValueByRef          = getDirectValueByRef;
     _sharedSveltoDictionaryNative = sharedSveltoDictionaryNative;
     _filterContextId = filterContextId;
 }
Exemplo n.º 2
0
            public bool TryGetPersistentFilters <T>(FilterContextID filterContextId, out EntityFilterCollectionsWithContextEnumerator enumerator)
            {
                if (_indicesOfPersistentFiltersUsedByThisComponent.TryFindIndex(
                        new NativeRefWrapperType(new RefWrapperType(typeof(T))), out var index) == true)
                {
                    enumerator = new EntityFilterCollectionsWithContextEnumerator(
                        _indicesOfPersistentFiltersUsedByThisComponent.GetDirectValueByRef(index),
                        _persistentEntityFilters, filterContextId);

                    return(true);
                }

                enumerator = default;
                return(false);
            }
Exemplo n.º 3
0
 public ref EntityFilterCollection GetOrCreatePersistentFilter <T>(int filterID,
                                                                   FilterContextID filterContextId, NativeRefWrapperType typeRef) where T : unmanaged, IEntityComponent
 {
     return(ref GetOrCreatePersistentFilter <T>(new CombinedFilterID(filterID, filterContextId), typeRef));
 }
Exemplo n.º 4
0
            public EntityFilterCollectionsWithContextEnumerator GetPersistentFilters <T>(FilterContextID filterContextId)
            {
                if (_indicesOfPersistentFiltersUsedByThisComponent.TryFindIndex(
                        new NativeRefWrapperType(new RefWrapperType(typeof(T))), out var index) == true)
                {
                    return(new EntityFilterCollectionsWithContextEnumerator(
                               _indicesOfPersistentFiltersUsedByThisComponent.GetDirectValueByRef(index),
                               _persistentEntityFilters, filterContextId));
                }

                throw new Exception($"no filters associated with the type {TypeCache<T>.name}");
            }
Exemplo n.º 5
0
 public ref EntityFilterCollection GetPersistentFilter <T>(int filterID, FilterContextID filterContextId)
     where T : unmanaged, IEntityComponent
 {
     return(ref GetPersistentFilter <T>(new CombinedFilterID(filterID, filterContextId)));
 }