Update: CC - Entity Loaded - Moorcow (v6a7eh2o29.js) 725 bytes modified

beta.r3js.org
-=yb4f310 2017-11-26 22:39:46 +01:00
parent 34526b795c
commit 0190ec32b9
1 changed files with 53 additions and 31 deletions

View File

@ -28,7 +28,6 @@ this.dom = GameLib.EntityManager.Instance.findComponentById('5wo9ve6emu');
this.renderer = GameLib.EntityManager.Instance.findComponentById('hat9imrjl1');
this.thrower = GameLib.EntityManager.Instance.findComponentById('fn4ywfqnho');
//this.renderer = GameLib.EntityManager.Instance.findComponentById('e4xb4aw01w');
this.treeSmall = GameLib.EntityManager.Instance.findComponentById('xcmk2jzxwa');
this.treeMedium = GameLib.EntityManager.Instance.findComponentById('wxc9hpu4vx');
this.treeLarge = GameLib.EntityManager.Instance.findComponentById('rio8uzlafp');
@ -109,12 +108,35 @@ GameLib.Event.Subscribe(
}.bind(this)
);
var mesh = null;
var material = null;
var smokeParticleEngine = null;
var explodeParticleEngine = null;
var fireParticleEngine = null;
this.meshes = {};
this.createMesh = function(meshType, type) {
var mesh = this[type].clone();
var material = this[type].materials[0].clone();
mesh = this[type].clone();
material = this[type].materials[0].clone();
mesh.materials = [material];
mesh.updateInstance();
explodeParticleEngine = this.explodeParticleEngine.clone();
explodeParticleEngine.position = mesh.position.clone();
explodeParticleEngine.updateInstance('position');
mesh.explodeParticleEngine = explodeParticleEngine;
smokeParticleEngine = this.smokeParticleEngine.clone();
smokeParticleEngine.position = mesh.position.clone();
smokeParticleEngine.updateInstance('position');
mesh.smokeParticleEngine = smokeParticleEngine;
fireParticleEngine = this.fireParticleEngine.clone();
fireParticleEngine.position = mesh.position.clone();
fireParticleEngine.updateInstance('position');
mesh.fireParticleEngine = fireParticleEngine;
if (typeof this.meshes[meshType] === 'undefined') {
this.meshes[meshType] = [];
@ -148,6 +170,9 @@ for (var n = 0; n < 5; n++) {
this.createMesh(5, 'santa');
}
for (var n = 0; n < 5; n++) {
this.createMesh(6, 'kanister');
}
/**
* Plant all our trees - Below code gets generated automatically
@ -159,9 +184,6 @@ var stone1 = this.stone1;
var stone2 = this.stone2;
var materialTreesAndRocks = this.materialTreesAndRocks;
var mesh = null;
var material = null;
mesh = stone2.clone();
material = materialTreesAndRocks.clone();
mesh.materials = [material];