public static bool InitComponentTypeId <TComponent>(bool isTag = false, bool isSimple = false, bool isCopyable = false, bool isDisposable = false, bool isVersioned = false, bool isVersionedNoState = false, bool isShared = false, bool isOneShot = false) { var isNew = (AllComponentTypes <TComponent> .typeId == -1); if (isTag == true) { WorldUtilities.SetComponentAsTag <TComponent>(); } if (isSimple == true) { WorldUtilities.SetComponentAsSimple <TComponent>(); } if (isVersioned == true) { WorldUtilities.SetComponentAsVersioned <TComponent>(); } if (isVersionedNoState == true) { WorldUtilities.SetComponentAsVersionedNoState <TComponent>(); } if (isCopyable == true) { WorldUtilities.SetComponentAsCopyable <TComponent>(); } if (isShared == true) { WorldUtilities.SetComponentAsShared <TComponent>(); } if (isDisposable == true) { WorldUtilities.SetComponentAsDisposable <TComponent>(); } if (isOneShot == true) { WorldUtilities.SetComponentAsOneShot <TComponent>(); } WorldUtilities.GetAllComponentTypeId <TComponent>(); return(isNew); }
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) { var reg = (StructComponents <T>)world.currentState.structComponents.list.arr[WorldUtilities.GetAllComponentTypeId <T>()]; this.minIdx = 0; var maxIdx = reg.components.Length; for (int i = 0; i < arr.Length; ++i) { var entity = arr.arr[i]; if (this.minIdx > entity.id) { this.minIdx = entity.id; } if (maxIdx < entity.id) { maxIdx = entity.id; } } this.data = new System.Span <T>(reg.components.arr, this.minIdx, maxIdx); }