Game completed state

Every time an answerObject is collected, we will check whether the total number of collected items is equal to the total number of objects in the answerObjects array to determine whether the game is complete by calling checkGameCompleteStatus.

/MERNVR/index.js:

 if (collectedTotal == this.state.game.answerObjects.length) {    AudioModule.playEnvironmental({       source: asset('happy-bot.mp3'),       loop: true    })    this.setState({hide: 'flex', hmMatrix: VrHeadModel.getHeadMatrix()}) }

If the game is indeed complete, we will perform the following actions:

  • Play the audio for game completed, using AudioModule.playEnvironmental
  • Fetch the current headMatrix value using VrHeadModel so it can be set as the transform matrix value for the

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.