Ejemplo n.º 1
0
        public static void CopyManagedObjects(ArchetypeManager typeMan, Chunk *srcChunk, int srcStartIndex,
                                              Chunk *dstChunk, int dstStartIndex, int count)
        {
            var srcArch = srcChunk->Archetype;
            var dstArch = dstChunk->Archetype;

            var srcI = 0;
            var dstI = 0;

            while (srcI < srcArch->TypesCount && dstI < dstArch->TypesCount)
            {
                if (srcArch->Types[srcI] < dstArch->Types[dstI])
                {
                    ++srcI;
                }
                else if (srcArch->Types[srcI] > dstArch->Types[dstI])
                {
                    ++dstI;
                }
                else
                {
                    if (srcArch->ManagedArrayOffset[srcI] >= 0)
                    {
                        for (var i = 0; i < count; ++i)
                        {
                            var obj = typeMan.GetManagedObject(srcChunk, srcI, srcStartIndex + i);
                            typeMan.SetManagedObject(dstChunk, dstI, dstStartIndex + i, obj);
                        }
                    }

                    ++srcI;
                    ++dstI;
                }
            }
        }
        public static unsafe void CopyManagedObjects(ArchetypeManager typeMan, Chunk *srcChunk, int srcStartIndex, Chunk *dstChunk, int dstStartIndex, int count)
        {
            Archetype *archetype     = srcChunk.Archetype;
            Archetype *archetypePtr2 = dstChunk.Archetype;
            int        index         = 0;
            int        num2          = 0;

            while ((index < archetype->TypesCount) && (num2 < archetypePtr2->TypesCount))
            {
                if (archetype->Types[index] < archetypePtr2->Types[num2])
                {
                    index++;
                    continue;
                }
                if (archetype->Types[index] > archetypePtr2->Types[num2])
                {
                    num2++;
                    continue;
                }
                if (archetype->ManagedArrayOffset[index] >= 0)
                {
                    int num3 = 0;
                    while (true)
                    {
                        if (num3 >= count)
                        {
                            break;
                        }
                        object val = typeMan.GetManagedObject(srcChunk, index, srcStartIndex + num3);
                        typeMan.SetManagedObject(dstChunk, num2, dstStartIndex + num3, val);
                        num3++;
                    }
                }
                index++;
                num2++;
            }
        }
Ejemplo n.º 3
0
 public object GetManagedObject(ArchetypeManager typeMan, int cachedBeginIndex, int index)
 {
     return(typeMan.GetManagedObject(m_CurrentChunk,
                                     m_CurrentMatchingArchetype->IndexInArchetype[IndexInComponentGroup], index - cachedBeginIndex));
 }
Ejemplo n.º 4
0
 public object GetManagedObject(ArchetypeManager typeMan, int typeIndexInArchetype, int cachedBeginIndex,
                                int index)
 {
     return(typeMan.GetManagedObject(m_CurrentChunk, typeIndexInArchetype, index - cachedBeginIndex));
 }
Ejemplo n.º 5
0
 public object GetManagedObject(ArchetypeManager typeMan, int cachedBeginIndex, int index)
 {
     return(typeMan.GetManagedObject(*m_CurrentChunk,
                                     m_CurrentMatchingArchetype->IndexInArchetype[IndexInEntityQuery], index - cachedBeginIndex));
 }
 public unsafe object GetManagedObject(ArchetypeManager typeMan, int cachedBeginIndex, int index) =>
 typeMan.GetManagedObject(this.m_CurrentChunk, &this.m_CurrentMatchingArchetype.IndexInArchetype.FixedElementField[this.IndexInComponentGroup], index - cachedBeginIndex);
 public unsafe object GetManagedObject(ArchetypeManager typeMan, int typeIndexInArchetype, int cachedBeginIndex, int index) =>
 typeMan.GetManagedObject(this.m_CurrentChunk, typeIndexInArchetype, index - cachedBeginIndex);