mazegame
This commit is contained in:
@@ -3,7 +3,7 @@ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
|
||||
import { MotionEngine } from '../../lib/MotionEngine';
|
||||
|
||||
var Game4 = function(context, gltf, w, h){
|
||||
this.game = new Group();
|
||||
this.object = new Group();
|
||||
const aq = new MotionEngine();
|
||||
const pr = [];
|
||||
let d = .51, c = w * h / 2, tc = w * h, m0=1, r0=.2;
|
||||
@@ -41,17 +41,17 @@ var Game4 = function(context, gltf, w, h){
|
||||
pr.forEach((c, i)=>{
|
||||
c.position.set((i % w)*d , (~~(i / w))*d);
|
||||
c.rotation.set(0, Math.PI, 0);
|
||||
this.game.add(c);
|
||||
this.object.add(c);
|
||||
context.clickable.add(c, clickFn);
|
||||
})
|
||||
|
||||
this.game.children[0].onBeforeRender = ()=>{
|
||||
this.object.children[0].onBeforeRender = ()=>{
|
||||
this.update();
|
||||
}
|
||||
});
|
||||
|
||||
var check = ()=>{
|
||||
if (!this.game.children.length) return false;
|
||||
if (!this.object.children.length) return false;
|
||||
return pr.filter(c=>c.$active === false).length == tc;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ var Game4 = function(context, gltf, w, h){
|
||||
aq.update();
|
||||
if (!this.done && check()){
|
||||
this.done = true;
|
||||
this.game.children.forEach((c, i)=>{
|
||||
this.object.children.forEach((c, i)=>{
|
||||
aq.add({
|
||||
o: c,
|
||||
a: {material:{opacity:1}},
|
||||
|
||||
Reference in New Issue
Block a user