コード例 #1
0
 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;
 }
コード例 #2
0
        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];
コード例 #3
0
 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);
 }