public void DestroyEntity(Entity entity) { int index = GetIndexOfEntityInBuffer(entity); if (index != -1) { this.entitiesInBuffer[index].command = EntityCommand.Destroy; ComponentDataInBuffer.Free(this.entitiesInBuffer[index].componentData); return; } Add(new EntityInBuffer(entity, EntityCommand.Destroy)); }
public bool AddOrSetComponentData <T>(Entity entity, T value) where T : unmanaged { int index = GetIndexOfEntityInBuffer(entity); if (index == -1) { index = Add(new EntityInBuffer(entity, EntityCommand.Modify)); } var entityInBuffer = this.entitiesInBuffer[index]; if (entityInBuffer.command == EntityCommand.Destroy) { return(false); } ComponentDataInBuffer.WriteToBuffer(entityInBuffer.componentData, value); return(true); }