internal EntityChunk(ILoggerFactory logFactory, IAllocator allocator, EntitySpec specifcation, int specIndex, int chunkIndex) { _logFactory = logFactory; _logger = _logFactory.CreateLogger <EntityChunk>(); _allocator = allocator; Specification = specifcation; PackedArray = new ComponentPackedArray(logFactory, _allocator, specifcation); _entityRefs = new NativeList <EntityRef>(_allocator, PackedArray.Length); SpecIndex = specIndex; ChunkIndex = chunkIndex; }
public void CanCreatePackedArray() { //arrange using var memory = new DynamicAllocator(_logFactory); var specification = new EntitySpec( ComponentType <Position> .Type, ComponentType <Velocity> .Type ); using var entityGroup = new ComponentPackedArray(_logFactory, memory, specification); //act var positions = entityGroup.GetComponentData <Position>(); var velocities = entityGroup.GetComponentData <Velocity>(); //assert for (var i = 0; i < entityGroup.Length; i++) { ref var p = ref positions[i]; ref var v = ref velocities[i];
internal static void CopyTo(ComponentPackedArray srcArray, int srcComponentIndex, int srcIndex, ComponentPackedArray dstArray, int dstComponentIndex, int dstIndex) { ComponentDataArray.CopyTo(srcArray._componentData[srcComponentIndex], srcIndex, dstArray._componentData[dstComponentIndex], dstIndex); }