43 lines
1000 B
JavaScript
43 lines
1000 B
JavaScript
var CubeEntity = include('entities/CubeEntity.js');
|
|
var MoveCubeCutscene = include('cutscenes/MoveCubeCutscene.js');
|
|
|
|
function CubeScene() {
|
|
this.cam = new Entity();
|
|
this.cam.add(POSITION);
|
|
this.cam.add(CAMERA);
|
|
|
|
this.cam.position.position = new Vec3(3, 3, 3);
|
|
this.cam.position.lookAt(new Vec3(0, 0, 0));
|
|
|
|
this.cube = new CubeEntity();
|
|
|
|
this.spriteEnt = new Entity();
|
|
this.spriteEnt.add(POSITION);
|
|
this.spriteEnt.position.position = new Vec3(16, 16, 0);
|
|
|
|
this.inputEnabled = false;
|
|
|
|
var scene = this;
|
|
Cutscene.play(new MoveCubeCutscene({ cube: this.cube })).then(function() {
|
|
scene.inputEnabled = true;
|
|
});
|
|
}
|
|
|
|
CubeScene.prototype = Object.create(Scene.prototype);
|
|
CubeScene.prototype.constructor = CubeScene;
|
|
|
|
CubeScene.prototype.update = function() {
|
|
if(this.inputEnabled) {
|
|
this.cube.update();
|
|
}
|
|
};
|
|
|
|
CubeScene.prototype.dispose = function() {
|
|
Cutscene.stop();
|
|
this.cam.dispose();
|
|
this.cube.dispose();
|
|
this.spriteEnt.dispose();
|
|
};
|
|
|
|
module = CubeScene;
|