fix position offset for renderer

beta.r3js.org
-=yb4f310 2017-11-15 14:25:37 +01:00
parent 4f48b3cc36
commit 2560a5c795
3 changed files with 23 additions and 7 deletions

View File

@ -33,7 +33,7 @@ GameLib.Event.COMPONENT_CLONED = 0xf;
GameLib.Event.TEXTURE_ANIMATED_CHANGE = 0x10;
GameLib.Event.ANIMATE_TEXTURE_INSTANCE = 0x11;
GameLib.Event.REMOVE_PARTICLE_ENGINE = 0x12;
//GameLib.Event.TEXTURE_INSTANCE_CREATED = 0x13;
GameLib.Event.PAUSE = 0x13;
GameLib.Event.TEXTURE_INSTANCE_UPDATED = 0x14;
//GameLib.Event.MATERIAL_INSTANCE_CREATED = 0x15;
GameLib.Event.MATERIAL_INSTANCE_UPDATED = 0x16;
@ -140,7 +140,7 @@ GameLib.Event.GetEventName = function(number) {
case 0x10 : return 'texture_animated_change';
case 0x11 : return 'animate_texture_instance';
case 0x12 : return 'remove_particle_engine';
case 0x13 : return 'unused';//'texture_instance_created';
case 0x13 : return 'pause';
case 0x14 : return 'texture_instance_updated';
case 0x15 : return 'unused';//'material_instance_created';
case 0x16 : return 'material_instance_updated';

View File

@ -203,20 +203,32 @@ GameLib.D3.Particle.prototype.cloneInstance = function() {
clone.position.add(this.positionOffset.instance);
}
var add = 1;
var addX = 1;
var addY = 1;
var addZ = 1;
if (this.positionOffsetType === GameLib.D3.Particle.POSITION_OFFSET_TYPE_RANDOM) {
add = GameLib.Utils.GetRandomIntInclusive(1,2);
addX = GameLib.Utils.GetRandomIntInclusive(1,2);
addY = GameLib.Utils.GetRandomIntInclusive(1,2);
addZ = GameLib.Utils.GetRandomIntInclusive(1,2);
if (add === 1) {
if (addX === 1) {
clone.position.x += Math.random() * this.positionOffset.x;
clone.position.y += Math.random() * this.positionOffset.y;
clone.position.z += Math.random() * this.positionOffset.z;
} else {
clone.position.x -= Math.random() * this.positionOffset.x;
}
if (addY === 1) {
clone.position.y -= Math.random() * this.positionOffset.y;
} else {
clone.position.y += Math.random() * this.positionOffset.y;
}
if (addZ === 1) {
clone.position.z -= Math.random() * this.positionOffset.z;
} else {
clone.position.z += Math.random() * this.positionOffset.z;
}
}

View File

@ -763,6 +763,10 @@ GameLib.System.Input.prototype.onKeyDown = function(event) {
)
}
if (event.code === 'KeyP') {
GameLib.Event.Emit(GameLib.Event.PAUSE);
}
};
GameLib.System.Input.prototype.onKeyUp = function(event) {