diff --git a/public/static/textures/hud.png b/public/static/textures/hud.png new file mode 100644 index 0000000..8b03b3b Binary files /dev/null and b/public/static/textures/hud.png differ diff --git a/public/static/textures/locked.webp b/public/static/textures/locked.webp new file mode 100644 index 0000000..f0793ea Binary files /dev/null and b/public/static/textures/locked.webp differ diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 6082565..a73a430 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -25,7 +25,7 @@ - + diff --git a/src/components/GamePlaying/GamePlaying.vue b/src/components/GamePreview/GamePreview.vue similarity index 99% rename from src/components/GamePlaying/GamePlaying.vue rename to src/components/GamePreview/GamePreview.vue index 6ab47e6..612d2f7 100644 --- a/src/components/GamePlaying/GamePlaying.vue +++ b/src/components/GamePreview/GamePreview.vue @@ -67,7 +67,7 @@ export default { }, data(){ return { - env: 'GamePlaying', + env: 'GamePreview', scenesList: [], objectsList: [], mode: 'translate', diff --git a/src/components/InteractiveObjects/GenenricObject.js b/src/components/InteractiveObjects/GenenricObject.js index e807497..f4b2434 100644 --- a/src/components/InteractiveObjects/GenenricObject.js +++ b/src/components/InteractiveObjects/GenenricObject.js @@ -2,6 +2,7 @@ import { getBoundingBox, getBoundingBoxCenterPoint, getBoundingBoxMaxLength, cen import { EventDispatcher, SphereGeometry, Mesh, MeshStandardMaterial, BackSide } from "three"; class GenericObject extends EventDispatcher{ + emits = ['finish'] constructor(engine, data){ super(); return new Promise(async(resolve, reject)=>{ diff --git a/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js b/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js index 0fb71d9..a7ee3bd 100644 --- a/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js +++ b/src/components/InteractiveObjects/MazeQuizGame/MazeQuizGame.js @@ -37,6 +37,7 @@ const defaults = { const tl = 4; class MazeQuizGame extends EventDispatcher { + emits = ['finish'] constructor(engine, data) { super(); data.noPhysics = true; @@ -48,7 +49,7 @@ class MazeQuizGame extends EventDispatcher { let ud1 = engine.physics.world.getCollider(e.handle1)?.parent()?.userData, ud2 = engine.physics.world.getCollider(e.handle2)?.parent()?.userData; let ud = {...ud1, ...ud2} - console.log('collision', ud) + //console.log('collision', ud) if (ud.finish){ if (e.started){ engine.dashboard.levelProgress.update(1) diff --git a/src/components/InteractiveObjects/PuzzleGame1.js b/src/components/InteractiveObjects/PuzzleGame1.js index 1007d10..644863a 100644 --- a/src/components/InteractiveObjects/PuzzleGame1.js +++ b/src/components/InteractiveObjects/PuzzleGame1.js @@ -3,6 +3,7 @@ import { MotionEngine } from '../../lib/MotionEngine'; import { centerOrigin } from '@/lib/MeshUtils'; class PuzzleGame1 extends EventDispatcher { + emits = ['finish'] constructor(engine, data) { super(); return new Promise(async (resolve, reject)=>{ diff --git a/src/components/InteractiveObjects/PuzzleGame2.js b/src/components/InteractiveObjects/PuzzleGame2.js index c20d87a..2c97450 100644 --- a/src/components/InteractiveObjects/PuzzleGame2.js +++ b/src/components/InteractiveObjects/PuzzleGame2.js @@ -3,6 +3,7 @@ import { MotionEngine } from '../../lib/MotionEngine'; import { centerOrigin } from '@/lib/MeshUtils'; class PuzzleGame2 extends EventDispatcher { + emits = ['finish'] constructor(engine, data) { super(); return new Promise(async (resolve, reject)=>{ diff --git a/src/components/InteractiveObjects/VideoPlayer.js b/src/components/InteractiveObjects/VideoPlayer.js index 4fcd49d..7033f0b 100644 --- a/src/components/InteractiveObjects/VideoPlayer.js +++ b/src/components/InteractiveObjects/VideoPlayer.js @@ -1,9 +1,10 @@ import { - PlaneGeometry, MeshStandardMaterial, SRGBColorSpace, + PlaneGeometry, MeshBasicMaterial, SRGBColorSpace, VideoTexture, DoubleSide, Mesh, EventDispatcher } from 'three'; class VideoPlayer extends EventDispatcher { + emits = ['finish'] constructor(engine, data){ super(); let vi, plane; @@ -15,7 +16,7 @@ class VideoPlayer extends EventDispatcher { let geometry = new PlaneGeometry( this.aspect, 1 ); let map = new VideoTexture( vi ); map.colorSpace = SRGBColorSpace; - let material = new MeshStandardMaterial( { + let material = new MeshBasicMaterial( { color: 0xffffff, map, transparent: true, diff --git a/src/lib/Dashboard.js b/src/lib/Dashboard.js index 460264e..b3ff476 100644 --- a/src/lib/Dashboard.js +++ b/src/lib/Dashboard.js @@ -109,7 +109,7 @@ class DashBoard { text:``, fontSize: 0.044, font: '/static/fonts/Montserrat-Bold.ttf', outlineColor: 0x113377, outlineWidth: '3%', anchorX: 'center', }) - pointsText.position.set(0.86 * engine.aspect/2, 0.47, 0); + pointsText.position.set(0.86 * engine.aspect/2, 0.47, -0.001); dash.add(pointsText); engine.addEventListener('beforeRender', ()=>{ diff --git a/src/mixins/GameEnvironmentMixin.js b/src/mixins/GameEnvironmentMixin.js index 7422558..be50195 100644 --- a/src/mixins/GameEnvironmentMixin.js +++ b/src/mixins/GameEnvironmentMixin.js @@ -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',()=>{ diff --git a/src/pages/play/[[id]].vue b/src/pages/preview/[[id]].vue similarity index 94% rename from src/pages/play/[[id]].vue rename to src/pages/preview/[[id]].vue index 56dfb6e..3456042 100644 --- a/src/pages/play/[[id]].vue +++ b/src/pages/preview/[[id]].vue @@ -1,6 +1,6 @@ diff --git a/src/pages/play/list.vue b/src/pages/preview/list.vue similarity index 91% rename from src/pages/play/list.vue rename to src/pages/preview/list.vue index 2580b99..e3fa5aa 100644 --- a/src/pages/play/list.vue +++ b/src/pages/preview/list.vue @@ -2,7 +2,7 @@ - +