public VoxelModel(Vector3Int size, Color32[] palette) { var voxelsCount = size.x * size.y * size.z; Size = size; Palette = palette; Voxels = new VoxelEntity[voxelsCount]; }
public void SpawnSingle(Vector3 worldPos, VoxelEntity voxel, float voxelSize, Vector3 velocity) { var emitterColor = new Color32(); // voxel.ColorIndex; var emitter = new ParticleSystem.EmitParams { position = worldPos, velocity = velocity, startSize = voxelSize, startLifetime = ParticleLifetime, startColor = emitterColor, }; _system.Emit(emitter, 1); }
public void SetVoxel(int index, VoxelEntity voxelEntity) { Voxels[index] = voxelEntity; }
public void SetVoxel(Vector3Int position, VoxelEntity voxelEntity) { var index = VoxelUtility.GetVoxelIndex(position, Size); Voxels[index] = voxelEntity; }
public void SetVoxel(int x, int y, int z, VoxelEntity voxelEntity) { var index = VoxelUtility.GetVoxelIndex(x, y, z, Size); Voxels[index] = voxelEntity; }