The rooms are a game mechanic used to show where animatronics are on the map or how close they are to you. The rooms are a game Mechanic that is used in all three Five Nights at Freddys games. The rooms are also used to give the game more purpose or detail and to make the game a little more interactive.
The rooms function is for the animatronics to move and get closer to you. Also it is used to show how far the enemies are away from you. They may also be used just for more detail to the game and make the game more interactive.