refactoring
This commit is contained in:
@@ -143,19 +143,23 @@ export default {
|
||||
}
|
||||
gameEngine.activeObjects.add(env.scene);
|
||||
}
|
||||
let expectToFinish = 0, finished = 0;;
|
||||
if (this.scene.data.items){
|
||||
let loaded = 0;
|
||||
for (let i of this.scene.data.items) {
|
||||
if (this.env == 'GamePlaying'){
|
||||
if (this.env != 'GameDesigner'){
|
||||
if (i.data.activationTriggers?.length || i.data.activationScore){
|
||||
i.data.shouldBeLocked = true;
|
||||
}
|
||||
}
|
||||
let io = await new InteractiveObject(gameEngine, i.data)
|
||||
i.__io = io;
|
||||
if (io.emits?.includes('finish')){
|
||||
expectToFinish++;
|
||||
}
|
||||
this.setObjectAttributes(l, i.data, io.object, io.source, 1);
|
||||
gameEngine.activeObjects.add(io.object);
|
||||
if (this.env == 'GamePlaying'){
|
||||
if (this.env != 'GameDesigner'){
|
||||
if (i.data.$go?.type == 'player3d'){
|
||||
let hero = new Hero(io.source, i.data.$go);
|
||||
hero.init(gameEngine);
|
||||
@@ -173,6 +177,7 @@ export default {
|
||||
}
|
||||
}
|
||||
io.addEventListener('finish', ()=>{
|
||||
finished ++;
|
||||
if (!i.data.pointsGiven){
|
||||
gameEngine.dashboard?.addPoints(i.data.points)
|
||||
}
|
||||
@@ -186,7 +191,11 @@ export default {
|
||||
gameEngine.dashboard.points > di.data.activationScore){
|
||||
di.__io.locker.unlock();
|
||||
}
|
||||
})
|
||||
});
|
||||
if (finished == expectToFinish){
|
||||
//GO TO NEXT LEVEL
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
loaded += 1/this.scene.data.items.length
|
||||
@@ -194,7 +203,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.scene.data.$intro && this.env == 'GamePlaying'){
|
||||
if (this.scene.data.$intro && this.env != 'GameDesigner'){
|
||||
let intro = await new VideoPlayer(gameEngine, {$go: this.scene.data.$intro, skipTransition: true, playInHud: true});
|
||||
gameEngine.activeObjects.add(intro.object);
|
||||
intro.video.addEventListener('pause',()=>{
|
||||
|
||||
Reference in New Issue
Block a user