2017-11-18 10:23:21 +01:00
|
|
|
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;
|
|
|
|
|
2018-04-10 15:48:32 +02:00
|
|
|
R3.Event.Emit(
|
|
|
|
R3.Event.PLAY_AUDIO,
|
2017-11-18 10:23:21 +01:00
|
|
|
{
|
|
|
|
name : 'Audio - Flamethrower'
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2018-04-10 15:48:32 +02:00
|
|
|
this.subscription = R3.Event.Subscribe(
|
|
|
|
R3.Event.AUDIO_ENDED,
|
2017-11-18 10:23:21 +01:00
|
|
|
function(data) {
|
|
|
|
if (data.audio.name === 'Audio - Flamethrower') {
|
2018-04-10 15:48:32 +02:00
|
|
|
R3.Event.Emit(R3.Event.MOUSE_UP);
|
2017-11-18 10:23:21 +01:00
|
|
|
if (this.subscription) {
|
|
|
|
this.subscription.remove();
|
|
|
|
this.subscription = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
|
|
|
|
return null;
|
|
|
|
//@ sourceURL=mouseDown.js
|