Exemplo n.º 1
0
        protected override void DrawVoxelChange(VoxelSpace voxels, Transform hitTransform, Vector3 hitLocation, Vector3i index)
        {
            var currentVoxel = voxels.GetVoxel(index);

            if (currentVoxel.HasValue)
            {
                ref var displayVoxels = ref _displayGridEntity.Get <VoxelGrid>();
                displayVoxels.SetVoxel(new Vector3i(0, 0, 0), currentVoxel.Value);
                _displayGridEntity.Set(displayVoxels);
            }
Exemplo n.º 2
0
        private static bool ShouldRenderSide(ref VoxelGrid grid, ref VoxelSpace space, VoxelTypes types, ushort otherType, int x, int y, int z)
        {
            var voxelIndex = new Vector3i(x, y, z);

            if (grid.ContainsIndex(voxelIndex))
            {
                var voxel = grid[x, y, z];

                return(!voxel.Exists || (types[voxel.BlockType].Transparent && voxel.BlockType != otherType));
            }
            else
            {
                var spaceIndex = space.GetSpaceIndexFromVoxelIndex(grid.MemberIndex, voxelIndex);
                var voxel      = space.GetVoxel(spaceIndex);

                return(!voxel.HasValue || !voxel.Value.Exists || (types[voxel.Value.BlockType].Transparent && voxel.Value.BlockType != otherType));
            }
        }