public bool FaceIsHidden(Block coveredBlock, Block coveringBlock, BlockFaceDirections blockFace) { switch (blockFace) { case BlockFaceDirections.FRONT: return(coveringBlock.GetBackFaceIsCovering() && coveredBlock.GetFrontFaceIsCovering()); case BlockFaceDirections.RIGHT: return(coveringBlock.GetLeftFaceIsCovering() && coveredBlock.GetRightFaceIsCovering()); case BlockFaceDirections.BACK: return(coveringBlock.GetFrontFaceIsCovering() && coveredBlock.GetBackFaceIsCovering()); case BlockFaceDirections.LEFT: return(coveringBlock.GetRightFaceIsCovering() && coveredBlock.GetLeftFaceIsCovering()); case BlockFaceDirections.BOTTOM: return(coveringBlock.GetTopFaceIsCovering() && coveredBlock.GetBottomFaceIsCovering()); case BlockFaceDirections.TOP: return(coveringBlock.GetBottomFaceIsCovering() && coveredBlock.GetTopFaceIsCovering()); } return(false); }
public bool BlockFaceAtPositionIsHidden(BlockFaceDirections faceType, BlockPosition position) { int x = position.X; int y = position.Y; int z = position.Z; switch (faceType) { case BlockFaceDirections.LEFT: if (x < xzDimension - 1) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x + 1, y, z]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; case BlockFaceDirections.FRONT: if (z < xzDimension - 1) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x, y, z + 1]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; case BlockFaceDirections.RIGHT: if (x > 0) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x - 1, y, z]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; case BlockFaceDirections.BACK: if (z > 0) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x, y, z - 1]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; case BlockFaceDirections.BOTTOM: if (y > 0) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x, y - 1, z]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; case BlockFaceDirections.TOP: if (y < HEIGHT_IN_BLOCKS - 1) { Block currentBlock = blocks[x, y, z]; Block neighborBlock = blocks[x, y + 1, z]; return(currentBlock.GetFaceHidingStrategy().FaceIsHidden(currentBlock, neighborBlock, faceType)); } break; } return(false); }
public bool FaceIsHidden(Block coveredBlock, Block coveringBlock, BlockFaceDirections blockFace) { return(coveringBlock.GetBlockType() != BlockTypes.AIR); }