예제 #1
0
        public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
        {
            var persistenceStateArray = batchInChunk.GetNativeArray(PersistenceStateType);
            var outputDataSubArray    = RawContainerData.GetSubArray(SubArrayOffset, SubArrayByteSize);

            if (batchInChunk.Has(BufferTypeHandle))
            {
                var untypedBufferAccessor = batchInChunk.GetUntypedBufferAccessor(ref BufferTypeHandle);
                // This execute method also updates meta data
                Execute(outputDataSubArray, MaxElements, untypedBufferAccessor, persistenceStateArray);
            }
            else
            {
                UpdateMetaDataForComponent.Execute(outputDataSubArray, ElementSize * MaxElements + PersistenceMetaData.SizeOfStruct, persistenceStateArray, 0);
            }
        }
예제 #2
0
        public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
        {
            var persistenceStateArray = batchInChunk.GetNativeArray(PersistenceStateType);
            var outputDataSubArray    = RawContainerData.GetSubArray(SubArrayOffset, SubArrayByteSize);

            if (batchInChunk.Has(ComponentTypeHandle))
            {
                if (TypeSize > 0)
                {
                    var byteArray = batchInChunk.GetComponentDataAsByteArray(ComponentTypeHandle);
                    // This execute method also updates meta data
                    Execute(outputDataSubArray, TypeSize, byteArray, persistenceStateArray);
                }
                else
                {
                    UpdateMetaDataForComponent.Execute(outputDataSubArray, TypeSize + PersistenceMetaData.SizeOfStruct, persistenceStateArray, 1);
                }
            }
            else
            {
                UpdateMetaDataForComponent.Execute(outputDataSubArray, TypeSize + PersistenceMetaData.SizeOfStruct, persistenceStateArray, 0);
            }
        }