Update: CC - Bacon - Entity Loaded (2xswm1bwq8.js) 422 bytes modified
parent
41b05d4921
commit
28af38e80c
|
@ -43,7 +43,7 @@ this.scoreTexture = GameLib.EntityManager.Instance.findComponentById('kva68t4dm8
|
||||||
* Animations
|
* Animations
|
||||||
*/
|
*/
|
||||||
this.animation = GameLib.EntityManager.Instance.findComponentById('tnlwgvf12x');
|
this.animation = GameLib.EntityManager.Instance.findComponentById('tnlwgvf12x');
|
||||||
this.animationSystems = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.SYSTEM_ANIMATION);
|
this.animationSystem = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.SYSTEM_ANIMATION)[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lights
|
* Lights
|
||||||
|
@ -583,26 +583,6 @@ GameLib.CustomCode.prototype.getBlockGridPositions = function (block) {
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.stopAnimations = function () {
|
|
||||||
this.animationSystems.map(
|
|
||||||
function (system) {
|
|
||||||
if (system.started) {
|
|
||||||
system.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}.bind(this)
|
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.startAnimations = function () {
|
|
||||||
this.animationSystems.map(
|
|
||||||
function (system) {
|
|
||||||
if (!system.started) {
|
|
||||||
system.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}.bind(this)
|
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.drawGrid = function () {
|
GameLib.CustomCode.prototype.drawGrid = function () {
|
||||||
|
|
||||||
var geometry = new THREE.BufferGeometry();
|
var geometry = new THREE.BufferGeometry();
|
||||||
|
@ -842,7 +822,7 @@ GameLib.CustomCode.prototype.rotateBlock = function (clockwise) {
|
||||||
var targetRotation = this.block.center.rotation.z + Math.PI / 2;
|
var targetRotation = this.block.center.rotation.z + Math.PI / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stopAnimations();
|
this.animationSystem.stop();
|
||||||
|
|
||||||
var originalRotation = this.block.center.rotation.z;
|
var originalRotation = this.block.center.rotation.z;
|
||||||
|
|
||||||
|
@ -856,13 +836,13 @@ GameLib.CustomCode.prototype.rotateBlock = function (clockwise) {
|
||||||
this.block.center.rotation.z = originalRotation;
|
this.block.center.rotation.z = originalRotation;
|
||||||
this.block.center.updateInstance('rotation');
|
this.block.center.updateInstance('rotation');
|
||||||
|
|
||||||
this.startAnimations();
|
this.animationSystem.start();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.block.center.rotation.z = originalRotation;
|
this.block.center.rotation.z = originalRotation;
|
||||||
|
|
||||||
this.startAnimations();
|
this.animationSystem.start();
|
||||||
|
|
||||||
this.block.center.rotation.z = targetRotation;
|
this.block.center.rotation.z = targetRotation;
|
||||||
this.block.center.updateInstance('rotation');
|
this.block.center.updateInstance('rotation');
|
||||||
|
@ -1327,7 +1307,7 @@ GameLib.CustomCode.prototype.spawnBigBlock = function () {
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.getNextBlock = function () {
|
GameLib.CustomCode.prototype.getNextBlock = function () {
|
||||||
|
|
||||||
this.stopAnimations();
|
this.animationSystem.stop();
|
||||||
|
|
||||||
this.block = this.spawnBigBlock();
|
this.block = this.spawnBigBlock();
|
||||||
|
|
||||||
|
@ -1338,7 +1318,7 @@ GameLib.CustomCode.prototype.getNextBlock = function () {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.startAnimations();
|
this.animationSystem.start();
|
||||||
|
|
||||||
this.animation.addMesh(this.block.center);
|
this.animation.addMesh(this.block.center);
|
||||||
|
|
||||||
|
@ -1376,7 +1356,7 @@ if (GameLib.Utils.UndefinedOrNull(this.subscriptions)) {
|
||||||
|
|
||||||
if (this.block && this.block.center) {
|
if (this.block && this.block.center) {
|
||||||
|
|
||||||
this.animation.removeMesh(this.block.center);
|
//this.animation.removeMesh(this.block.center);
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.REMOVE_COMPONENT,
|
GameLib.Event.REMOVE_COMPONENT,
|
||||||
|
|
Loading…
Reference in New Issue