253 lines
4.9 KiB
JavaScript
253 lines
4.9 KiB
JavaScript
if (this.parentEntity === data.entity) {
|
|
console.log('my entity loaded :)');
|
|
} else {
|
|
return;
|
|
}
|
|
|
|
this.enemies = [];
|
|
|
|
var particle = GameLib.EntityManager.Instance.findComponentById('0k1hhfy3dk');
|
|
particle.instance.visible = false;
|
|
|
|
/**
|
|
* Min and max spawn time is in seconds
|
|
*/
|
|
GameLib.D3.CustomCode.MIN_SPAWN_TIME = 1;
|
|
GameLib.D3.CustomCode.MAX_SPAWN_TIME = 4;
|
|
|
|
/**
|
|
* Tell all our custom code components that we loaded
|
|
*/
|
|
this.beforeRender = GameLib.EntityManager.Instance.findComponentById('qi81k80v08');
|
|
this.beforeRender.entityLoaded = this;
|
|
|
|
this.mouseUp = GameLib.EntityManager.Instance.findComponentById('1n3iofhi8x');
|
|
this.mouseUp.entityLoaded = this;
|
|
|
|
this.mouseDown = GameLib.EntityManager.Instance.findComponentById('iullyllylb');
|
|
this.mouseDown.entityLoaded = this;
|
|
|
|
this.mouseMove = GameLib.EntityManager.Instance.findComponentById('ud33b2z225');
|
|
this.mouseMove.entityLoaded = this;
|
|
|
|
/**
|
|
* Plant all our trees
|
|
*/
|
|
var treeSmall = GameLib.EntityManager.Instance.findComponentById('m02lo48i7y');
|
|
var treeMedium = GameLib.EntityManager.Instance.findComponentById('g2f23vpbfg');
|
|
var treeLarge = GameLib.EntityManager.Instance.findComponentById('3tldspycol');
|
|
|
|
var scene = GameLib.EntityManager.Instance.findComponentById('q1f5n01iqk');
|
|
|
|
var i = 0;
|
|
var tempTree = null;
|
|
|
|
var largeTrees = [];
|
|
var mediumTrees = [];
|
|
var smallTrees = [];
|
|
|
|
for (i = 1; i <= 20; i += 1) {
|
|
tempTree = treeLarge.clone();
|
|
tempTree.position.x = Math.cos(i) * 50;
|
|
tempTree.position.z = -1 * Math.sin(i) * 60;
|
|
|
|
tempTree.useQuaternion = false;
|
|
tempTree.rotation.y = i;
|
|
|
|
if (i === 1) {
|
|
tempTree.position.x = 48.84;
|
|
tempTree.position.z = -1.1;
|
|
}
|
|
|
|
if (i === 2) {
|
|
tempTree.position.x = -60.41;
|
|
tempTree.position.z = -87.26;
|
|
}
|
|
|
|
if (i === 4) {
|
|
tempTree.position.x = -55.42;
|
|
tempTree.position.z = 12.01;
|
|
}
|
|
|
|
if (i === 5) {
|
|
tempTree.position.x = 48.84;
|
|
tempTree.position.z = -13.59;
|
|
}
|
|
|
|
if (i === 6) {
|
|
tempTree.position.x = -42.31;
|
|
tempTree.position.z = -64.16;
|
|
}
|
|
|
|
if (i === 8) {
|
|
tempTree.position.x = 73.82;
|
|
tempTree.position.z = -13.59;
|
|
}
|
|
|
|
if (i === 10) {
|
|
tempTree.position.z = -45.43;
|
|
}
|
|
|
|
if (i === 11) {
|
|
tempTree.position.x = -77.89;
|
|
tempTree.position.z = -51.05;
|
|
}
|
|
|
|
if (i === 12) {
|
|
tempTree.position.x = 53.21;
|
|
tempTree.position.z = -67.91;
|
|
}
|
|
|
|
if (i === 14) {
|
|
tempTree.position.x = 69.45;
|
|
tempTree.position.z = -59.44;
|
|
}
|
|
|
|
if (i === 16) {
|
|
tempTree.position.x = -80.39;
|
|
tempTree.position.z = -28.57;
|
|
}
|
|
|
|
if (i === 17) {
|
|
tempTree.position.x = -81.64;
|
|
tempTree.position.z = -73.52;
|
|
}
|
|
|
|
if (i === 18) {
|
|
tempTree.position.x = -82.89;
|
|
tempTree.position.z = -61.66;
|
|
}
|
|
|
|
tempTree.updateInstance();
|
|
largeTrees.push(tempTree);
|
|
}
|
|
|
|
for (i = 1; i <= 20; i += 1) {
|
|
tempTree = treeMedium.clone();
|
|
tempTree.position.x = Math.cos(i) * 70;
|
|
tempTree.position.z = -1 * Math.sin(i) * 70;
|
|
|
|
tempTree.useQuaternion = false;
|
|
tempTree.rotation.y = i;
|
|
|
|
if (i === 4) {
|
|
tempTree.position.x = -31.69;
|
|
tempTree.position.z = -32.32;
|
|
}
|
|
|
|
if (i === 5) {
|
|
tempTree.position.x = 25.74;
|
|
tempTree.position.z = -30.45;
|
|
}
|
|
|
|
if (i === 6) {
|
|
tempTree.position.x = -21.71;
|
|
tempTree.position.z = -59.16;
|
|
}
|
|
|
|
if (i === 8) {
|
|
tempTree.position.x = 9.51;
|
|
tempTree.position.z = -69.26;
|
|
}
|
|
|
|
if (i === 10) {
|
|
tempTree.position.x = -58.74;
|
|
tempTree.position.z = -66.66;
|
|
}
|
|
|
|
if (i === 11) {
|
|
tempTree.position.x = 66.33;
|
|
tempTree.position.z = 3.27;
|
|
}
|
|
|
|
if (i === 12) {
|
|
tempTree.position.x = 50.72;
|
|
tempTree.position.z = -27.95;
|
|
}
|
|
|
|
if (i === 16) {
|
|
tempTree.position.x = -67.04;
|
|
tempTree.position.z = -57.92;
|
|
}
|
|
|
|
if (i === 17) {
|
|
tempTree.position.x = -32.94;
|
|
tempTree.position.z = -79.77;
|
|
}
|
|
|
|
if (i === 18) {
|
|
tempTree.position.x = 71.94;
|
|
tempTree.position.z = -48.55;
|
|
}
|
|
|
|
tempTree.updateInstance();
|
|
mediumTrees.push(tempTree);
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; i <= 20; i += 1) {
|
|
tempTree = treeSmall.clone();
|
|
tempTree.position.x = Math.cos(i) * 40;
|
|
tempTree.position.z = -1 * Math.sin(i) * 50;
|
|
|
|
tempTree.useQuaternion = false;
|
|
tempTree.rotation.y = i;
|
|
|
|
if (i === 3) {
|
|
tempTree.position.x = -44.81;
|
|
tempTree.position.z = 3.27;
|
|
}
|
|
|
|
if (i === 4) {
|
|
tempTree.position.x = 35.73;
|
|
tempTree.position.z = -21.71;
|
|
}
|
|
|
|
if (i === 5) {
|
|
tempTree.position.x = 47.6;
|
|
tempTree.position.z = 2.64;
|
|
}
|
|
|
|
if (i === 9) {
|
|
tempTree.position.x = -38.56;
|
|
tempTree.position.z = -6.1;
|
|
}
|
|
|
|
if (i === 10) {
|
|
tempTree.position.x = 16.38;
|
|
tempTree.position.z = -57.29;
|
|
}
|
|
|
|
if (i === 11) {
|
|
tempTree.position.x = -11.09;
|
|
tempTree.position.z = -67.91;
|
|
}
|
|
|
|
if (i === 12) {
|
|
tempTree.position.x = -27.32;
|
|
tempTree.position.z = -43.56;
|
|
}
|
|
|
|
if (i === 13) {
|
|
tempTree.position.x = 36.36;
|
|
tempTree.position.z = -12.34;
|
|
}
|
|
|
|
if (i === 17) {
|
|
tempTree.position.x = -18.58;
|
|
tempTree.position.z = -84.14;
|
|
}
|
|
|
|
if (i === 18) {
|
|
tempTree.position.x = 19.5;
|
|
tempTree.position.z = -88.51;
|
|
}
|
|
|
|
tempTree.updateInstance();
|
|
smallTrees.push(tempTree);
|
|
}
|
|
|
|
|
|
//@ sourceURL=entityLoaded.js
|