added ambient sound feature

This commit is contained in:
2025-11-14 16:08:51 +02:00
parent 006d159a0f
commit 8eea84b697
5 changed files with 42 additions and 3 deletions
+6 -2
View File
@@ -100,7 +100,7 @@ export default {
async expandScenarioData(scene){
const promises = [];
['environment', 'scene', 'intro'].filter(e=>scene.data[e]).forEach(e=>{
['environment', 'scene', 'intro', 'audio'].filter(e=>scene.data[e]).forEach(e=>{
promises.push(this.$api.gameObject.load(scene.data[e]).then(r=>scene.data['$'+e] = r.data))
})
@@ -130,6 +130,10 @@ export default {
if (this.scene.data.$environment){
await gameEngine.loadPanorama(this.scene.data.$environment.asset.name);
}
if (this.scene.data.$audio){
await gameEngine.playAmbientSound(this.scene.data.$audio.asset.name);
gameEngine.ambientSound.setVolume( 0.5 );
}
if (this.scene.data.$scene){
let env = await gameEngine.load(this.scene.data.$scene.asset.name);
this.setObjectAttributes(l, this.scene.data, env.scene, env, 100);
@@ -194,7 +198,7 @@ export default {
});
if (finished == expectToFinish){
//GO TO NEXT LEVEL
console.log('LEVEL FINISHED')
}
})
}