Scoring and awarding system improvements
This commit is contained in:
Binary file not shown.
@@ -28,6 +28,8 @@ const InteractiveObjectsImports = {
|
||||
class InteractiveObject extends EventManager{
|
||||
constructor(engine, obj) {
|
||||
super();
|
||||
this.minPoints = 0;
|
||||
this.maxPoints = obj.points || 0;
|
||||
this.name = obj.name;
|
||||
return new Promise(async (resolve, reject) => {
|
||||
switch (obj.type || 'GenericObject') {
|
||||
|
||||
@@ -45,6 +45,10 @@ class MazeQuizGame extends EventManager {
|
||||
data.noPhysics = true;
|
||||
params.mazeFile = data.style || 'quiz-s2.gltf';
|
||||
params.io = this;
|
||||
|
||||
this.maxPoints = (data.points || 0) + (data.questionPoints||0) * data.questions.length;
|
||||
this.minPoints = this.maxPoints - (data.questionPenalty||0) * data.questions.length;
|
||||
|
||||
return new Promise(async (resolve, reject)=>{
|
||||
let questions = data.shuffle ? Utils.shuffleArray(data.questions) : data.questions;
|
||||
let def = this.generate(questions);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getBoundingBox, getBoundingBoxCenterPoint, getBoundingBoxMaxLength, centerOrigin } from "@/lib/MeshUtils";
|
||||
import { SphereGeometry, Mesh, MeshStandardMaterial, BackSide, Group } from "three";
|
||||
import { SphereGeometry, Mesh, MeshStandardMaterial, Group } from "three";
|
||||
import { EventManager } from '@/lib/EventManager';
|
||||
|
||||
class SceneSwitcher extends EventManager{
|
||||
@@ -11,9 +10,14 @@ class SceneSwitcher extends EventManager{
|
||||
this.object = new Group()
|
||||
if (data.switchType == 'award'){
|
||||
let gltf = await engine.load('trophy.glb', '/static/meshes/scene-switcher/');
|
||||
this.object.add(gltf.scene);
|
||||
let awards = {};
|
||||
gltf.scene.traverse(o=>{
|
||||
awards[o.name] = o;
|
||||
o.position.multiplyScalar(0);
|
||||
})
|
||||
this.object.add(awards.silver);
|
||||
engine.motionQueue.add({
|
||||
o: gltf.scene,
|
||||
o: awards.silver,
|
||||
a:{rotation: { y: k=>k*Math.PI*2 }}, r: true, t: 4
|
||||
})
|
||||
}else if(data.switchType == 'sphere'){
|
||||
|
||||
Reference in New Issue
Block a user