Esempio n. 1
0
        internal static object CloneAndPatchManagedComponent(object obj, EntityRemapUtility.EntityRemapInfo *remapping)
        {
            var clone = CloneManagedComponent(obj);

            EntityRemapUtility.PatchEntityInBoxedType(clone, remapping);
            return(clone);
        }
        public void PatchEntities(ManagedComponentStore managedComponentStore, Archetype *archetype, Chunk *chunk, int entityCount,
                                  EntityRemapUtility.EntityRemapInfo *remapping)
        {
#if !NET_DOTS
            var managedPatches    = archetype->ManagedEntityPatches;
            var managedPatchCount = archetype->ManagedEntityPatchCount;

            // Patch managed components with entity references.
            for (int p = 0; p < managedPatchCount; p++)
            {
                var componentType = managedPatches[p].Type;

                for (int i = 0; i != entityCount; i++)
                {
                    var obj = managedComponentStore.GetManagedObject(chunk, componentType, i);
                    EntityRemapUtility.PatchEntityInBoxedType(obj, remapping);
                }
            }
#endif
        }
Esempio n. 3
0
        public void PatchEntities(Archetype *archetype, Chunk *chunk, int entityCount,
                                  EntityRemapUtility.EntityRemapInfo *remapping)
        {
#if !NET_DOTS
            var firstManagedComponent = archetype->FirstManagedComponent;
            var numManagedComponents  = archetype->NumManagedComponents;
            for (int i = 0; i < numManagedComponents; ++i)
            {
                int type = i + firstManagedComponent;
                var a    = (int *)ChunkDataUtility.GetComponentDataRO(chunk, 0, type);
                for (int ei = 0; ei < entityCount; ++ei)
                {
                    if (a[ei] != 0)
                    {
                        var obj = m_ManagedComponentData[a[ei]];
                        EntityRemapUtility.PatchEntityInBoxedType(obj, remapping);
                    }
                }
            }
#endif
        }