Beispiel #1
0
        /// <summary>
        /// Invoked for each <see cref="Entity"/> member encountered.
        /// </summary>
        /// <param name="property">The property being visited.</param>
        /// <param name="container">The source container.</param>
        /// <param name="value">The entity value.</param>
        /// <typeparam name="TContainer">The container type.</typeparam>
        /// <returns>The status of the adapter visit.</returns>
        VisitStatus IVisit <Entity> .Visit <TContainer>(Property <TContainer, Entity> property, ref TContainer container, ref Entity value)
        {
            value = null != m_Info
                ? EntityRemapUtility.RemapEntity(m_Info, value)
                : EntityRemapUtility.RemapEntityForPrefab(m_PrefabSrc, m_PrefabDst, m_PrefabCount, value);

            return(VisitStatus.Stop);
        }
Beispiel #2
0
        public void RemapChunk(Archetype *arch, Chunk *chunk, int baseIndex, int count, ref NativeArray <EntityRemapUtility.EntityRemapInfo> entityRemapping)
        {
            Assert.AreEqual(chunk->Archetype->Offsets[0], 0);
            Assert.AreEqual(chunk->Archetype->SizeOfs[0], sizeof(Entity));

            var entityInChunkStart = (Entity *)(chunk->Buffer) + baseIndex;

            for (var i = 0; i != count; i++)
            {
                var entityInChunk = entityInChunkStart + i;
                var target        = EntityRemapUtility.RemapEntity(ref entityRemapping, *entityInChunk);
                var entity        = m_Entities + target.Index;
                Assert.AreEqual(entity->Version, target.Version);

                entityInChunk->Index   = target.Index;
                entityInChunk->Version = entity->Version;
                entity->IndexInChunk   = baseIndex + i;
                entity->Archetype      = arch;
                entity->Chunk          = chunk;
            }
        }
 unsafe public VisitStatus Visit <TProperty, TContainer>(IPropertyVisitor visitor, TProperty property, ref TContainer container, ref Entity value, ref ChangeTracker changeTracker)
     where TProperty : IProperty <TContainer, Entity>
 {
     value = EntityRemapUtility.RemapEntity(RemapInfo, value);
     return(VisitStatus.Handled);
 }