added effects back in
This commit is contained in:
parent
53f75e305a
commit
1c9f94f3c0
@ -300,7 +300,7 @@ function createBloodSplatter(position) {
|
|||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
position: position,
|
position: position,
|
||||||
lifetime: 4,
|
lifetime: 4,
|
||||||
"name": "Blood SPlatter",
|
"name": "Blood Splatter",
|
||||||
"color": {
|
"color": {
|
||||||
red: 230,
|
red: 230,
|
||||||
green: 2,
|
green: 2,
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
this.firingOffsets = {
|
this.firingOffsets = {
|
||||||
z: 0.3
|
z: 0.3
|
||||||
}
|
}
|
||||||
|
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
||||||
|
this.fireVolume = 0.5;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pistol.prototype = {
|
Pistol.prototype = {
|
||||||
@ -41,7 +43,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
continueNearGrab: function() {
|
continueNearGrab: function() {
|
||||||
if(!this.equipped) {
|
if (!this.equipped) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.updateLaser();
|
this.updateLaser();
|
||||||
@ -67,7 +69,9 @@
|
|||||||
print("UNEQUIP")
|
print("UNEQUIP")
|
||||||
this.hand = null;
|
this.hand = null;
|
||||||
this.equipped = false;
|
this.equipped = false;
|
||||||
Overlays.editOverlay(this.laser, {visible: false});
|
Overlays.editOverlay(this.laser, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
@ -93,10 +97,18 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
fire: function() {
|
fire: function() {
|
||||||
var pickRay = {origin: this.barrelPoint, direction: this.firingDirection};
|
var pickRay = {
|
||||||
|
origin: this.barrelPoint,
|
||||||
|
direction: this.firingDirection
|
||||||
|
};
|
||||||
|
Audio.playSound(this.fireSound, {
|
||||||
|
position: this.barrelPoint,
|
||||||
|
volume: this.fireVolume
|
||||||
|
});
|
||||||
|
this.createGunFireEffect(this.barrelPoint)
|
||||||
var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
|
var intersection = Entities.findRayIntersectionBlocking(pickRay, true);
|
||||||
if(intersection.intersects) {
|
if (intersection.intersects) {
|
||||||
print('intersection!');
|
this.createEntityHitEffect(intersection.intersection);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -116,7 +128,186 @@
|
|||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
this.mapping.disable();
|
this.mapping.disable();
|
||||||
Overlays.deleteOverlay(this.laser); }
|
Overlays.deleteOverlay(this.laser);
|
||||||
|
},
|
||||||
|
|
||||||
|
createEntityHitEffect: function(position) {
|
||||||
|
var flash = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
position: position,
|
||||||
|
lifetime: 4,
|
||||||
|
"name": "Flash Emitter",
|
||||||
|
"color": {
|
||||||
|
red: 228,
|
||||||
|
green: 128,
|
||||||
|
blue: 12
|
||||||
|
},
|
||||||
|
"maxParticles": 1000,
|
||||||
|
"lifespan": 0.15,
|
||||||
|
"emitRate": 1000,
|
||||||
|
"emitSpeed": 1,
|
||||||
|
"speedSpread": 0,
|
||||||
|
"emitOrientation": {
|
||||||
|
"x": -0.4,
|
||||||
|
"y": 1,
|
||||||
|
"z": -0.2,
|
||||||
|
"w": 0.7071068286895752
|
||||||
|
},
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"polarStart": 0,
|
||||||
|
"polarFinish": Math.PI,
|
||||||
|
"azimuthStart": -3.1415927410125732,
|
||||||
|
"azimuthFinish": 2,
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"particleRadius": 0.03,
|
||||||
|
"radiusSpread": 0.02,
|
||||||
|
"radiusStart": 0.02,
|
||||||
|
"radiusFinish": 0.03,
|
||||||
|
"colorSpread": {
|
||||||
|
red: 100,
|
||||||
|
green: 100,
|
||||||
|
blue: 20
|
||||||
|
},
|
||||||
|
"alpha": 1,
|
||||||
|
"alphaSpread": 0,
|
||||||
|
"alphaStart": 0,
|
||||||
|
"alphaFinish": 0,
|
||||||
|
"additiveBlending": true,
|
||||||
|
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Entities.editEntity(flash, {
|
||||||
|
isEmitting: false
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
createGunFireEffect: function(position) {
|
||||||
|
var smoke = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
position: position,
|
||||||
|
lifetime: 1,
|
||||||
|
"name": "Smoke Hit Emitter",
|
||||||
|
"maxParticles": 1000,
|
||||||
|
"lifespan": 4,
|
||||||
|
"emitRate": 20,
|
||||||
|
emitSpeed: 0,
|
||||||
|
"speedSpread": 0,
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"polarStart": 0,
|
||||||
|
"polarFinish": 0,
|
||||||
|
"azimuthStart": -3.1415927410125732,
|
||||||
|
"azimuthFinish": 3.14,
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0.5,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": .2,
|
||||||
|
"y": 0,
|
||||||
|
"z": .2
|
||||||
|
},
|
||||||
|
"radiusSpread": .04,
|
||||||
|
"particleRadius": 0.07,
|
||||||
|
"radiusStart": 0.07,
|
||||||
|
"radiusFinish": 0.07,
|
||||||
|
"alpha": 0.7,
|
||||||
|
"alphaSpread": 0,
|
||||||
|
"alphaStart": 0,
|
||||||
|
"alphaFinish": 0,
|
||||||
|
"additiveBlending": 0,
|
||||||
|
"textures": "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png"
|
||||||
|
});
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Entities.editEntity(smoke, {
|
||||||
|
isEmitting: false
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
var flash = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
position: position,
|
||||||
|
lifetime: 4,
|
||||||
|
"name": "Muzzle Flash",
|
||||||
|
"color": {
|
||||||
|
red: 228,
|
||||||
|
green: 128,
|
||||||
|
blue: 12
|
||||||
|
},
|
||||||
|
"maxParticles": 1000,
|
||||||
|
"lifespan": 0.1,
|
||||||
|
"emitRate": 1000,
|
||||||
|
"emitSpeed": 0.5,
|
||||||
|
"speedSpread": 0,
|
||||||
|
"emitOrientation": {
|
||||||
|
"x": -0.4,
|
||||||
|
"y": 1,
|
||||||
|
"z": -0.2,
|
||||||
|
"w": 0.7071068286895752
|
||||||
|
},
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"polarStart": 0,
|
||||||
|
"polarFinish": Math.PI,
|
||||||
|
"azimuthStart": -3.1415927410125732,
|
||||||
|
"azimuthFinish": 2,
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"particleRadius": 0.05,
|
||||||
|
"radiusSpread": 0.01,
|
||||||
|
"radiusStart": 0.05,
|
||||||
|
"radiusFinish": 0.05,
|
||||||
|
"colorSpread": {
|
||||||
|
red: 100,
|
||||||
|
green: 100,
|
||||||
|
blue: 20
|
||||||
|
},
|
||||||
|
"alpha": 1,
|
||||||
|
"alphaSpread": 0,
|
||||||
|
"alphaStart": 0,
|
||||||
|
"alphaFinish": 0,
|
||||||
|
"additiveBlending": true,
|
||||||
|
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Entities.editEntity(flash, {
|
||||||
|
isEmitting: false
|
||||||
|
});
|
||||||
|
}, 100)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user