Filamentous fungi produce so called hydrophobins, water-repellent proteins. These proteins form a protective layer over, for instance, mushrooms. That's why mushrooms can handle rain much better than we can.
Picture courtesy of bK, taken from his blog, emo biochemist