April 2020
Intermediate to advanced
716 pages
18h 55m
English
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. We will achieve this by calling the checkGameCompleteStatus method, which will perform this check, as shown in the following code:
/MERNVR/index.js
checkGameCompleteStatus = (collectedTotal) => { if (collectedTotal == this.state.game.answerObjects.length) { AudioModule.playEnvironmental({ source: asset('happy-bot.mp3'), loop: true }) this.setState({hide: 'flex', hmMatrix: VrHeadModel.getHeadMatrix()}) }}
In this method, we first confirm that the game is indeed complete, and then we perform the following actions: ...