Stability Criterion for Nonsmooth Systems and Nash Equilibrium Seeking via Projected Gradient Dynamics