dashboard and progressbar

This commit is contained in:
2025-10-30 18:54:28 +02:00
parent fb9c5c66e9
commit 6253fc32d7
7 changed files with 123 additions and 71 deletions
@@ -1,6 +1,6 @@
import { Group, Vector3, Matrix4, Mesh, Quaternion, PlaneGeometry, MeshStandardMaterial, DoubleSide } from 'three';
import { Group, Vector3, Matrix4, Mesh, Quaternion, PlaneGeometry, MeshStandardMaterial, DoubleSide, CanvasTexture, SRGBColorSpace } from 'three';
import { InteractiveObject } from '../InteractiveObject';
import { ActiveEvents } from '@dimforge/rapier3d';
import Utils from '@/lib/Utils';
class MazeObject {
constructor(engine, def, params = {}){
@@ -22,13 +22,17 @@ class MazeQuizGame {
this.mazeObject = new MazeObject(engine, def)
engine.addEventListener('collision', async e=>{
let ud = engine.phy.world.getCollider(e.handle2)?.parent()?.userData;
if (ud?.finish && engine.hero?.animationsMap?.win){
if (ud?.finish){
if (e.started){
engine.dashboard.updateProgress(1)
engine.hero.animationsMap._idle = engine.hero.animationsMap.idle
engine.hero.animationsMap.idle = engine.hero.animationsMap.win
engine.hero.characterControls.cameraDelta = Math.PI;
if ( engine.hero.animationsMap?.win){
engine.hero.animationsMap.idle = engine.hero.animationsMap.win
}
await Utils.wait(1000);
engine.hero.characterControls.cameraDelta = Math.PI;
engine.hero.characterControls.direction += Math.PI;
//engine.hero.model.rotation.y += Math.PI;
await Utils.wait(10000);
this.onfinish?.()
}else{
@@ -36,6 +40,12 @@ class MazeQuizGame {
engine.hero.characterControls.cameraDelta = 0
}
}
if (ud.qid !== undefined && e.started){
engine.dashboard.update({
hint: ud.question.q
})
engine.dashboard.updateProgress(ud.qid / questions.length)
}
//console.log(e, ud, engine.hero?.animationsMap);
})
}