public bool Has <T>(ArchetypeChunkSharedComponentType <T> chunkComponentType)
            where T : struct, ISharedComponentData
        {
            var typeIndexInArchetype = ChunkDataUtility.GetIndexInTypeArray(m_Chunk->Archetype, chunkComponentType.m_TypeIndex);

            return(typeIndexInArchetype != -1);
        }
        public uint GetComponentVersion <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData)
            where T : struct, ISharedComponentData
        {
            var typeIndexInArchetype = ChunkDataUtility.GetIndexInTypeArray(m_Chunk->Archetype, chunkSharedComponentData.m_TypeIndex);

            if (typeIndexInArchetype == -1)
            {
                return(0);
            }
            return(m_Chunk->GetChangeVersion(typeIndexInArchetype));
        }
        public int GetSharedComponentIndex <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData)
            where T : struct, ISharedComponentData
        {
            var archetype            = m_Chunk->Archetype;
            var typeIndexInArchetype = ChunkDataUtility.GetIndexInTypeArray(archetype, chunkSharedComponentData.m_TypeIndex);

            if (typeIndexInArchetype == -1)
            {
                return(-1);
            }

            var chunkSharedComponentIndex = typeIndexInArchetype - archetype->FirstSharedComponent;
            var sharedComponentIndex      = m_Chunk->GetSharedComponentValue(chunkSharedComponentIndex);

            return(sharedComponentIndex);
        }
Esempio n. 4
0
        public int GetSharedComponentIndex <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData)
            where T : struct, ISharedComponentData
        {
            var archetype            = m_Chunk->Archetype;
            var typeIndex            = chunkSharedComponentData.m_TypeIndex;
            var typeIndexInArchetype = GetIndexInArchetype(typeIndex);

            if (typeIndexInArchetype == -1)
            {
                return(-1);
            }

            var chunkSharedComponentIndex = archetype->SharedComponentOffset[typeIndexInArchetype];
            var sharedComponentIndex      = m_Chunk->SharedComponentValueArray[chunkSharedComponentIndex];

            return(sharedComponentIndex);
        }
        public unsafe int GetSharedComponentIndex <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData) where T : struct, ISharedComponentData
        {
            int num4;

            Unity.Entities.Archetype *archetype = this.m_Chunk.Archetype;
            int indexInTypeArray = ChunkDataUtility.GetIndexInTypeArray(archetype, chunkSharedComponentData.m_TypeIndex);

            if (indexInTypeArray == -1)
            {
                num4 = -1;
            }
            else
            {
                int index = archetype->SharedComponentOffset[indexInTypeArray];
                num4 = this.m_Chunk.SharedComponentValueArray[index];
            }
            return(num4);
        }
 public T GetSharedComponentData <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData, EntityManager entityManager)
     where T : struct, ISharedComponentData
 {
     return(entityManager.GetSharedComponentData <T>(GetSharedComponentIndex(chunkSharedComponentData)));
 }
 public bool DidChange <T>(ArchetypeChunkSharedComponentType <T> chunkSharedComponentData, uint version) where T : struct, ISharedComponentData
 {
     return(ChangeVersionUtility.DidChange(GetComponentVersion(chunkSharedComponentData), version));
 }