Hamlet is making fun of Osric for his hat, and the way he takes it off and puts it back on again throughout the passage. Hamlet, through the interaction, presents 'truths' about the temperature and then immediately changes them to see how Osric responds. This passage shows the lengths a servant will go to to try and appease or please the prince, even though Hamlet is just messing with him.