private static void SpawnEntity(ref EntityCommandBuffer.Concurrent commandBuffer, ref AroundCenterCyclicSpawner spawner, ref Random randomGenerator, int entityInQueryIndex) { var spawnedEntity = commandBuffer.Instantiate(entityInQueryIndex, spawner.EntityToSpawn); ApplyRandomPositionOnCircle(ref commandBuffer, ref spawner, ref randomGenerator, entityInQueryIndex, spawnedEntity); ApplyRandomColor(ref commandBuffer, ref randomGenerator, entityInQueryIndex, spawnedEntity); }
private static void ApplyRandomPositionOnCircle(ref EntityCommandBuffer.Concurrent commandBuffer, ref AroundCenterCyclicSpawner spawner, ref Random randomGenerator, int entityInQueryIndex, Entity spawnedEntity) { float3 randomPosition = GetRandomPositionOnCircle(ref randomGenerator, spawner.SpawnDistance); Translation translation = new Translation { Value = randomPosition }; commandBuffer.SetComponent(entityInQueryIndex, spawnedEntity, translation); }