Programming dynamic barriers

I have a shooter game where the player is fighting against 3 enemies. When the player kills all three of them, player has to move to an other area. Here is the pic:

So we begin at 1. The colored boxes are the walls or barriers. When the enemies are still acitve you cant trespass through the barrier. Only when they are killed. And when they are killed, the player has to go to 2. After the traspassing the blue barrier should then not be trespassable and the green one also. Then the 3 enemies can spawn in area 2. And so on. Do you guys know how I can implement that kind of dynamic barrier?

OK I will assume here that you are using the navmesh for navigation
Well, you can create a NavMeshObstacle with carving enabled. This creates a temporary hole in the NavMesh, while the object is active.
The other option is to create a NavMeshLink, which is a kind of ‘jump’ between two locations on the navmesh. The are won’t be smoothli navigable, as a normal navmesh would, but the advantage is that it can be set to one-directional passage, so easier for you to prevent the player from going back and forth