This commit is contained in:
@@ -72,7 +72,7 @@ class InteractiveObject extends EventManager{
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.io.addEventListener('interaction', ()=>{
|
this.io.addEventListener('interaction', ()=>{
|
||||||
engine.tm?.setGameObject(obj.$go?.id);
|
engine.tm?.setGameObject(obj.id);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -65,11 +65,15 @@ class MazeQuizGame extends EventManager {
|
|||||||
if ( engine.hero.animationsMap?.win){
|
if ( engine.hero.animationsMap?.win){
|
||||||
engine.hero.animationsMap.idle = engine.hero.animationsMap.win
|
engine.hero.animationsMap.idle = engine.hero.animationsMap.win
|
||||||
}
|
}
|
||||||
await Utils.wait(1000);
|
// await Utils.wait(1000);
|
||||||
engine.hero.cameraDelta = Math.PI;
|
// engine.hero.cameraDelta = Math.PI;
|
||||||
engine.hero.direction += Math.PI;
|
// engine.hero.direction += Math.PI;
|
||||||
//engine.hero.model.rotation.y += Math.PI;
|
//engine.hero.model.rotation.y += Math.PI;
|
||||||
await Utils.wait(10000);
|
engine.motionQueue.add({
|
||||||
|
o: engine.hero,
|
||||||
|
a:{cameraDelta: k=>k*Math.PI*6 },
|
||||||
|
t: 12
|
||||||
|
});
|
||||||
this.dispatchEvent({type:'finish'})
|
this.dispatchEvent({type:'finish'})
|
||||||
}else{
|
}else{
|
||||||
engine.hero.animationsMap.idle = engine.hero.animationsMap._idle
|
engine.hero.animationsMap.idle = engine.hero.animationsMap._idle
|
||||||
@@ -79,15 +83,19 @@ class MazeQuizGame extends EventManager {
|
|||||||
if (ud.qid !== undefined && e.started){
|
if (ud.qid !== undefined && e.started){
|
||||||
engine.dashboard.updateText(ud.question.q)
|
engine.dashboard.updateText(ud.question.q)
|
||||||
engine.dashboard.levelProgress.update(ud.qid / questions.length)
|
engine.dashboard.levelProgress.update(ud.qid / questions.length)
|
||||||
|
this.dispatchEvent({type:'interaction'});
|
||||||
}
|
}
|
||||||
if (ud.corner && e.started){
|
if (ud.corner && e.started){
|
||||||
let q = ud.corner.question;
|
let q = ud.corner.question;
|
||||||
if (!q.pointsAdded){
|
if (!q.pointsAdded){
|
||||||
|
let qid = data.questions.indexOf(q);
|
||||||
if (!ud.corner.penalty){
|
if (!ud.corner.penalty){
|
||||||
q.pointsAdded = true;
|
q.pointsAdded = true;
|
||||||
engine.dashboard.addPoints(data.questionPoints - !!q.applyPenalty * data.questionPenalty)
|
engine.dashboard.addPoints(data.questionPoints - !!q.applyPenalty * data.questionPenalty)
|
||||||
|
engine.tm?.post('answer', null, { question: qid, correct: true });
|
||||||
}else{
|
}else{
|
||||||
q.applyPenalty = true;
|
q.applyPenalty = true;
|
||||||
|
engine.tm?.post('answer', null, { question: qid, correct: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,8 +104,7 @@ class MazeQuizGame extends EventManager {
|
|||||||
})
|
})
|
||||||
await this.mazeObject.load();
|
await this.mazeObject.load();
|
||||||
this.object = this.mazeObject.object;
|
this.object = this.mazeObject.object;
|
||||||
resolve(this)
|
resolve(this);
|
||||||
this.dispatchEvent({type:'interaction'});
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+30
-6
@@ -5,16 +5,23 @@ class Telemetry {
|
|||||||
#af = null;
|
#af = null;
|
||||||
|
|
||||||
constructor(apiFunction, mode){
|
constructor(apiFunction, mode){
|
||||||
this.events = [];
|
this.mode = mode;
|
||||||
this.#af = apiFunction;
|
this.#af = apiFunction;
|
||||||
}
|
}
|
||||||
setGame(game){
|
setGame(game){
|
||||||
if (this.game == game) { return; }
|
if (this.game == game) { return; }
|
||||||
if (this.game){
|
if (this.game){
|
||||||
this.#af('game:leave', this.game, {game: this.game, duration: Math.round(performance.now()/1000) - this.gameStart});
|
this.#af('game:leave', this.game, {
|
||||||
|
mode: this.mode,
|
||||||
|
game: this.game,
|
||||||
|
duration: Math.round(performance.now()/1000) - this.gameStart
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (game){
|
if (game){
|
||||||
this.#af('game:enter', game, {game});
|
this.#af('game:enter', game, {
|
||||||
|
mode: this.mode,
|
||||||
|
game
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.game = game;
|
this.game = game;
|
||||||
this.gameStart = Math.round(performance.now()/1000);
|
this.gameStart = Math.round(performance.now()/1000);
|
||||||
@@ -23,12 +30,17 @@ class Telemetry {
|
|||||||
if (this.scene == scene) { return; }
|
if (this.scene == scene) { return; }
|
||||||
if (this.scene){
|
if (this.scene){
|
||||||
this.#af('scene:leave', this.scene, {
|
this.#af('scene:leave', this.scene, {
|
||||||
|
mode: this.mode,
|
||||||
duration: Math.round(performance.now()/1000) - this.sceneStart,
|
duration: Math.round(performance.now()/1000) - this.sceneStart,
|
||||||
game: this.game, scene: this.scene
|
game: this.game, scene: this.scene
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (scene){
|
if (scene){
|
||||||
this.#af('scene:enter', scene, {game: this.game, scene});
|
this.#af('scene:enter', scene, {
|
||||||
|
mode: this.mode,
|
||||||
|
game: this.game,
|
||||||
|
scene
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.sceneStart = Math.round(performance.now()/1000);
|
this.sceneStart = Math.round(performance.now()/1000);
|
||||||
@@ -37,18 +49,30 @@ class Telemetry {
|
|||||||
if (this.gameObject == gameObject) { return; }
|
if (this.gameObject == gameObject) { return; }
|
||||||
if (this.gameObject){
|
if (this.gameObject){
|
||||||
this.#af('gameobject:leave', this.gameObject, {
|
this.#af('gameobject:leave', this.gameObject, {
|
||||||
|
mode: this.mode,
|
||||||
duration: Math.round(performance.now()/1000) - this.gameObjectStart,
|
duration: Math.round(performance.now()/1000) - this.gameObjectStart,
|
||||||
game: this.game, scene: this.scene, gameObject: this.gameObject
|
game: this.game, scene: this.scene, gameObject: this.gameObject
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (gameObject){
|
if (gameObject){
|
||||||
this.#af('gameobject:enter', gameObject, {game: this.game, scene: this.scene, gameObject});
|
this.#af('gameobject:enter', gameObject, {
|
||||||
|
mode: this.mode,
|
||||||
|
game: this.game,
|
||||||
|
scene: this.scene,
|
||||||
|
gameObject
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.gameObject = gameObject;
|
this.gameObject = gameObject;
|
||||||
this.gameObjectStart = Math.round(performance.now()/1000);
|
this.gameObjectStart = Math.round(performance.now()/1000);
|
||||||
}
|
}
|
||||||
post(action, object, data){
|
post(action, object, data){
|
||||||
this.#af('gameobject:' + action, object, {game: this.game, scene: this.scene, gameObject: this.gameObject, data});
|
this.#af('gameobject:' + action, object, {
|
||||||
|
mode: this.mode,
|
||||||
|
game: this.game,
|
||||||
|
scene: this.scene,
|
||||||
|
gameObject: this.gameObject,
|
||||||
|
data
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.resize();
|
this.resize();
|
||||||
|
|
||||||
engine.tm?.setGame(this.object?.id);
|
|
||||||
//engine.setCamera(engine.orthographicCamera)
|
//engine.setCamera(engine.orthographicCamera)
|
||||||
//engine.setCameraOrthographic();
|
//engine.setCameraOrthographic();
|
||||||
if (!this.scenario) {
|
if (!this.scenario) {
|
||||||
@@ -125,6 +124,7 @@ export default {
|
|||||||
* @param target Target scene definition from Game Module
|
* @param target Target scene definition from Game Module
|
||||||
*/
|
*/
|
||||||
async loadEnvironment(scene, target){
|
async loadEnvironment(scene, target){
|
||||||
|
engine.tm?.setGame(this.object?.id);
|
||||||
//await engine.loadPanorama(`/asset/default/43.webp`);
|
//await engine.loadPanorama(`/asset/default/43.webp`);
|
||||||
let intro;
|
let intro;
|
||||||
engine.clearScene();
|
engine.clearScene();
|
||||||
|
|||||||
Reference in New Issue
Block a user