Have a variable `count` that starts at zero. Each time your player interacts with a cube, increment `count` and hide the cube. Once `count` reaches 6 you know that the cubes have been collected so can unlock the door.
↧