r3-custom-code/p6aqxjt7ku.js

45 lines
1.1 KiB
JavaScript

if (!this.entityLoaded) {
return;
}
if (!this.initialized) {
/**
* Link some objects for MouseDown component
*/
this.throwerParticleEngine = this.entityLoaded.throwerParticleEngine;
this.beforeRender = this.entityLoaded.beforeRender;
this.mouseMove = this.entityLoaded.mouseMove;
this.initialized = true;
}
this.beforeRender.mouseIsDown = true;
this.mouseMove.mouseIsDown = true;
this.throwerParticleEngine.enabled = true;
this.throwerParticleEngine.particlesPerSecond = 50;
this.throwerParticleEngine.updateInstance('particlesPerSecond');
this.throwerParticleEngine.templateParticle.speed = 300;
this.throwerParticleEngine.templateParticle.scale.x = 15;
R3.Event.Emit(
R3.Event.PLAY_AUDIO,
{
name : 'Audio - Flamethrower'
}
);
this.subscription = R3.Event.Subscribe(
R3.Event.AUDIO_ENDED,
function(data) {
if (data.audio.name === 'Audio - Flamethrower') {
R3.Event.Emit(R3.Event.MOUSE_UP);
if (this.subscription) {
this.subscription.remove();
this.subscription = null;
}
}
}.bind(this)
);
return null;
//@ sourceURL=mouseDown.js