mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
fireworks but no smoke
This commit is contained in:
parent
769a5ecca9
commit
208096f2e0
1 changed files with 13 additions and 14 deletions
|
@ -50,7 +50,7 @@
|
||||||
y: 0.7,
|
y: 0.7,
|
||||||
z: 0.24
|
z: 0.24
|
||||||
};
|
};
|
||||||
_this.missle = Entities.addEntity({
|
var missle = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: MODEL_URL,
|
modelURL: MODEL_URL,
|
||||||
position: rocketPosition,
|
position: rocketPosition,
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
var smokeTrailPosition = Vec3.sum(rocketPosition, {
|
var smokeTrailPosition = Vec3.sum(rocketPosition, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -missleDimensions.y/2 + 0.08,
|
y: -missleDimensions.y/2 + 0.1,
|
||||||
z: 0
|
z: 0
|
||||||
});
|
});
|
||||||
var smokeSettings = {
|
var smokeSettings = {
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
parentID: _this.missle
|
parentID: _this.missle
|
||||||
};
|
};
|
||||||
|
|
||||||
_this.smoke = Entities.addEntity(smokeSettings);
|
var smoke = Entities.addEntity(smokeSettings);
|
||||||
|
|
||||||
smokeSettings.colorStart = {
|
smokeSettings.colorStart = {
|
||||||
red: 75,
|
red: 75,
|
||||||
|
@ -142,31 +142,31 @@
|
||||||
smokeSettings.emitRate = 200;
|
smokeSettings.emitRate = 200;
|
||||||
smokeSettings.emitterShouldTrail = false;
|
smokeSettings.emitterShouldTrail = false;
|
||||||
smokeSettings.name = "fire emitter";
|
smokeSettings.name = "fire emitter";
|
||||||
_this.fire = Entities.addEntity(smokeSettings);
|
var fire = Entities.addEntity(smokeSettings);
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
var explodePosition = Entities.getEntityProperties(_this.missle, "position").position;
|
var explodePosition = Entities.getEntityProperties(missle, "position").position;
|
||||||
_this.explodeFirework(explodePosition);
|
_this.explodeFirework(smoke, fire, missle, explodePosition);
|
||||||
}, randFloat(_this.timeToExplosionRange.min, _this.timeToExplosionRange.max));
|
}, randFloat(_this.timeToExplosionRange.min, _this.timeToExplosionRange.max));
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
explodeFirework: function(explodePosition) {
|
explodeFirework: function(smoke, fire, missle, explodePosition) {
|
||||||
// We just exploded firework, so stop emitting its fire and smoke
|
// We just exploded firework, so stop emitting its fire and smoke
|
||||||
Entities.editEntity(_this.smoke, {
|
Entities.editEntity(smoke, {
|
||||||
parentID: null,
|
parentID: null,
|
||||||
isEmitting: false
|
isEmitting: false
|
||||||
});
|
});
|
||||||
Entities.editEntity(_this.fire, {
|
Entities.editEntity(fire, {
|
||||||
parentID: null,
|
parentID: null,
|
||||||
isEmitting: false
|
isEmitting: false
|
||||||
});
|
});
|
||||||
Entities.deleteEntity(_this.missle);
|
Entities.deleteEntity(missle);
|
||||||
Audio.playSound(_this.explosionSound, {
|
Audio.playSound(_this.explosionSound, {
|
||||||
position: explodePosition
|
position: explodePosition
|
||||||
});
|
});
|
||||||
var fireworkSettings = {
|
var firework = Entities.addEntity({
|
||||||
name: "fireworks emitter",
|
name: "fireworks emitter",
|
||||||
position: explodePosition,
|
position: explodePosition,
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
|
@ -203,12 +203,11 @@
|
||||||
alphaStart: Math.random(),
|
alphaStart: Math.random(),
|
||||||
alphaFinish: Math.random(),
|
alphaFinish: Math.random(),
|
||||||
textures: "http://ericrius1.github.io/PlatosCave/assets/star.png",
|
textures: "http://ericrius1.github.io/PlatosCave/assets/star.png",
|
||||||
};
|
});
|
||||||
|
|
||||||
_this.firework = Entities.addEntity(fireworkSettings);
|
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
Entities.editEntity(_this.firework, {
|
Entities.editEntity(firework, {
|
||||||
isEmitting: false
|
isEmitting: false
|
||||||
});
|
});
|
||||||
}, _this.explodeTime);
|
}, _this.explodeTime);
|
||||||
|
|
Loading…
Reference in a new issue