public void Push(World world, ME.ECS.Collections.BufferArray <Entity> arr) { var reg = (StructComponents <T>)world.currentState.structComponents.list.arr[WorldUtilities.GetAllComponentTypeId <T>()]; for (int i = 0; i < arr.Length; ++i) { var entity = arr.arr[i]; reg.components.arr[entity.id] = this.Get(entity.id); reg.componentsStates.arr[entity.id] = 1; } }
public DataBuffer(World world, ME.ECS.Collections.BufferArray <Entity> arr, int minIdx, int maxIdx) { var reg = (StructComponents <T>)world.currentState.structComponents.list.arr[WorldUtilities.GetAllComponentTypeId <T>()]; this.minIdx = minIdx; if (this.minIdx > maxIdx) { this.minIdx = 0; maxIdx = 0; } if (this.minIdx < 0) { this.minIdx = 0; } if (maxIdx >= reg.components.Length) { maxIdx = reg.components.Length - 1; } this.Length = maxIdx - this.minIdx; this.arr = new Unity.Collections.NativeArray <T>(reg.components.arr, Unity.Collections.Allocator.Persistent); this.data = new Unity.Collections.NativeSlice <T>(this.arr, this.minIdx, maxIdx); }