camera idle behavior
This commit is contained in:
@@ -28,10 +28,11 @@ class MazeQuizGame {
|
||||
return this.object;
|
||||
}
|
||||
|
||||
generate(questions, idx = 0, len){
|
||||
let cq = questions[idx]
|
||||
if (!cq) return {
|
||||
generate(questions, qid = 0, len){
|
||||
let question = questions[qid]
|
||||
if (!question) return {
|
||||
len:3,
|
||||
finish: true,
|
||||
objects:[
|
||||
{
|
||||
type: 'gltf',
|
||||
@@ -51,15 +52,15 @@ class MazeQuizGame {
|
||||
let directions = Utils.shuffleArray( ['l', 'r', 'f'] )
|
||||
|
||||
let mo = {
|
||||
len,
|
||||
len, question, qid,
|
||||
objects:[
|
||||
{
|
||||
type: 'text', text: cq.q, fontSize:0.033, width:0.5, position:[0,.33,len + .96], rotation:[0,Math.PI, 0]
|
||||
type: 'text', text: question.q, fontSize:0.033, width:0.5, position:[0,.33,len + .96], rotation:[0,Math.PI, 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
cq.a.forEach((a, i)=>{
|
||||
question.a.forEach((a, i)=>{
|
||||
let d = directions[i];
|
||||
mo.objects.push(
|
||||
defaults.arrows[d](len),
|
||||
@@ -74,7 +75,7 @@ class MazeQuizGame {
|
||||
if (i == 0){
|
||||
mo[d] = {
|
||||
len: 3,
|
||||
[dd]: this.generate(questions, idx + 1, 3)
|
||||
[dd]: this.generate(questions, qid + 1, 3)
|
||||
}
|
||||
}else{
|
||||
mo[d] = {
|
||||
@@ -83,7 +84,7 @@ class MazeQuizGame {
|
||||
len: 2,
|
||||
objects:[
|
||||
{
|
||||
type: 'text', width:0.5, color:0xff0000, text: cq.h, fontSize:0.033, position:[0,.44,2+.96], rotation:[0,Math.PI, 0]
|
||||
type: 'text', width:0.5, color:0xff0000, text: question.h, fontSize:0.033, position:[0,.44,2+.96], rotation:[0,Math.PI, 0]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user