6. In $\triangle A B C$, it is known that $B C=a, C A=b, A B$ $=c$, and the inradius is $r$. If $r=\frac{1}{2}(a+b-c)$, then $\triangle A B C$ is ( ).
(A) Acute triangle
(B) Right triangle
(C) Isosceles triangle
(D) Equilateral triangle
6. B.

Let the incircle $\odot O$ touch $AC$ and $BC$ at points $D$ and $E$, respectively. Then $CD = CE = \frac{a+b-c}{2} = r$.
Also, $OD \perp CD, OE \perp CE$
$\Rightarrow CD \perp CE \Rightarrow \angle C = 90^{\circ}$.