2017-11-27 13:46:06 +01:00
|
|
|
if (this.parentEntity === data.entity) {
|
2018-03-06 14:50:37 +01:00
|
|
|
console.log('my entity loaded :)');
|
2017-11-27 13:46:06 +01:00
|
|
|
} else {
|
2018-03-06 14:50:37 +01:00
|
|
|
return;
|
2017-11-27 13:46:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
this.enemies = [];
|
|
|
|
|
|
|
|
/**
|
2018-03-06 14:50:37 +01:00
|
|
|
* Min and max spawn time is in seconds
|
|
|
|
*/
|
2018-01-11 11:01:25 +01:00
|
|
|
GameLib.CustomCode.MIN_SPAWN_TIME = 1;
|
|
|
|
GameLib.CustomCode.MAX_SPAWN_TIME = 4;
|
|
|
|
GameLib.CustomCode.OBJECT_BUFFER_SIZE = 5;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
|
|
|
/**
|
2018-03-06 14:50:37 +01:00
|
|
|
* Create references to all our 'in game' objects
|
|
|
|
*/
|
2018-03-06 15:25:00 +01:00
|
|
|
this.fog = GameLib.EntityManager.Instance.findComponentById('prn0bjxe3h')
|
2017-11-27 13:46:06 +01:00
|
|
|
this.bull = GameLib.EntityManager.Instance.findComponentById('cpcuzjjx27');
|
|
|
|
this.star = GameLib.EntityManager.Instance.findComponentById('lc7boe8lul');
|
|
|
|
this.burger = GameLib.EntityManager.Instance.findComponentById('suwsyomgc8');
|
|
|
|
this.parcel = GameLib.EntityManager.Instance.findComponentById('vikv0e8s04');
|
|
|
|
this.santa = GameLib.EntityManager.Instance.findComponentById('r0gkv2m07t');
|
|
|
|
this.camera = GameLib.EntityManager.Instance.findComponentById('2f5l1jt4yw');
|
2018-03-06 15:24:03 +01:00
|
|
|
this.scene = GameLib.EntityManager.Instance.findComponentById('z3ktrimsp8');
|
2017-11-27 13:46:06 +01:00
|
|
|
this.cursor = GameLib.EntityManager.Instance.findComponentById('zfu27tmjn4');
|
|
|
|
this.dom = GameLib.EntityManager.Instance.findComponentById('bl5vh0d2mt');
|
|
|
|
|
2018-03-07 05:35:29 +01:00
|
|
|
this.renderer = GameLib.EntityManager.Instance.findComponentById('wid7sf7y35');
|
2017-11-27 13:46:06 +01:00
|
|
|
this.thrower = GameLib.EntityManager.Instance.findComponentById('xtukuakue3');
|
|
|
|
//this.renderer = GameLib.EntityManager.Instance.findComponentById('e4xb4aw01w');
|
|
|
|
this.treeSmall = GameLib.EntityManager.Instance.findComponentById('66lfvqjnsh');
|
|
|
|
this.treeMedium = GameLib.EntityManager.Instance.findComponentById('jkfx0aimom');
|
|
|
|
this.treeLarge = GameLib.EntityManager.Instance.findComponentById('53cg0zj637');
|
|
|
|
this.stone1 = GameLib.EntityManager.Instance.findComponentById('ouacwomksb');
|
|
|
|
this.stone2 = GameLib.EntityManager.Instance.findComponentById('zaen0snqwc');
|
|
|
|
this.kanister = GameLib.EntityManager.Instance.findComponentById('01hun2dd7x');
|
|
|
|
|
2018-03-06 15:26:49 +01:00
|
|
|
this.leftLight = GameLib.EntityManager.Instance.findComponentById('lbzb38hku5');
|
|
|
|
this.rightLight = GameLib.EntityManager.Instance.findComponentById('lbzb38hku5');
|
2018-03-07 05:36:38 +01:00
|
|
|
this.throwerLight = GameLib.EntityManager.Instance.findComponentById('z1jjutmra1');
|
2017-11-27 13:46:06 +01:00
|
|
|
this.scoreCanvas = GameLib.EntityManager.Instance.findComponentById('0j1szvj8gp');
|
|
|
|
this.scoreTexture = GameLib.EntityManager.Instance.findComponentById('u8la6bqi9x');
|
2018-03-07 05:33:38 +01:00
|
|
|
this.scoreMesh = GameLib.EntityManager.Instance.findComponentById('nnmuq10dbl');
|
2017-11-27 13:46:06 +01:00
|
|
|
|
|
|
|
this.throwerParticleEngine = GameLib.EntityManager.Instance.findComponentById('ofo2ota5bo');
|
|
|
|
this.smokeParticleEngine = GameLib.EntityManager.Instance.findComponentById('ulks1tuug6');
|
|
|
|
this.fireParticleEngine = GameLib.EntityManager.Instance.findComponentById('t15omdm43f');
|
|
|
|
this.explodeParticleEngine = GameLib.EntityManager.Instance.findComponentById('gwi8qiymy5');
|
|
|
|
this.materialTreesAndRocks = GameLib.EntityManager.Instance.findComponentById('g91m1tk6so');
|
|
|
|
|
|
|
|
this.burningTreeParticleEngine = GameLib.EntityManager.Instance.findComponentById('jdn84unl9b');
|
|
|
|
|
|
|
|
GameLib.Event.Emit(
|
2018-03-06 14:50:37 +01:00
|
|
|
GameLib.Event.GET_RUNTIME,
|
|
|
|
null,
|
|
|
|
function(runtime) {
|
|
|
|
this.graphics = runtime.graphics
|
|
|
|
}.bind(this)
|
2017-11-27 13:46:06 +01:00
|
|
|
);
|
|
|
|
|
2018-03-06 15:28:51 +01:00
|
|
|
this.mouse = new GameLib.Mouse();
|
2017-11-27 13:46:06 +01:00
|
|
|
this.raycaster = new GameLib.D3.Raycaster(this.graphics);
|
|
|
|
|
|
|
|
this.beforeRender = GameLib.EntityManager.Instance.findComponentById('qemp4een6t');
|
|
|
|
this.mouseUp = GameLib.EntityManager.Instance.findComponentById('f0m7ptlxf3');
|
|
|
|
this.mouseDown = GameLib.EntityManager.Instance.findComponentById('jtmr6gmp5p');
|
|
|
|
this.mouseMove = GameLib.EntityManager.Instance.findComponentById('lxigrx11oc');
|
|
|
|
this.touchMove = GameLib.EntityManager.Instance.findComponentById('evwkow5289');
|
|
|
|
|
|
|
|
/**
|
2018-01-14 14:06:55 +01:00
|
|
|
* Tell all our custom code components that we loaded
|
|
|
|
*/
|
2017-11-27 13:46:06 +01:00
|
|
|
GameLib.Event.Subscribe(
|
2018-03-06 14:50:37 +01:00
|
|
|
GameLib.Event.CUSTOM_GAME_START,
|
|
|
|
function() {
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
delete this.beforeRender.initialized;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
this.beforeRender.entityLoaded = this;
|
|
|
|
this.mouseUp.entityLoaded = this;
|
|
|
|
this.mouseDown.entityLoaded = this;
|
|
|
|
this.mouseMove.entityLoaded = this;
|
|
|
|
this.touchMove.entityLoaded = this;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
GameLib.Event.Emit(GameLib.Event.WINDOW_RESIZE, {width : window.innerWidth, height:window.innerHeight});
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
this.camera.lookAt.x = 0;
|
|
|
|
this.camera.lookAt.y = 0;
|
|
|
|
this.camera.lookAt.z = 0;
|
|
|
|
this.camera.updateInstance('lookAt');
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
this.mouse.x = 0;
|
|
|
|
this.mouse.y = 0;
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
}.bind(this)
|
2017-11-27 13:46:06 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2018-03-06 14:50:37 +01:00
|
|
|
* Plant all our trees - Below code gets generated automatically
|
|
|
|
*/
|
2017-11-27 13:46:06 +01:00
|
|
|
|
2017-11-27 15:35:18 +01:00
|
|
|
|
2017-11-27 13:46:06 +01:00
|
|
|
GameLib.Event.Emit(GameLib.Event.GAME_LOADED);
|
|
|
|
|
2018-03-06 14:50:37 +01:00
|
|
|
//@ sourceURL=entityLoaded.js
|