From 46c6999dd4e7a46c389ed1876acde12856649dbc Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Wed, 11 May 2016 09:59:50 -0700 Subject: [PATCH] add fire sound --- .../DomainContent/Home/firePit/fire.js | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/firePit/fire.js b/unpublishedScripts/DomainContent/Home/firePit/fire.js index 17cd431dd9..b0ed9a61b6 100644 --- a/unpublishedScripts/DomainContent/Home/firePit/fire.js +++ b/unpublishedScripts/DomainContent/Home/firePit/fire.js @@ -57,6 +57,8 @@ Fire.prototype = { preload: function(entityID) { this.entityID = entityID; + this.EXPLOSION_SOUND = SoundCache.getSound("atp:/firepit/fire_burst.wav"); + }, collisionWithEntity: function(myID, otherID, collisionInfo) { var otherProps = Entities.getEntityProperties(otherID); @@ -72,11 +74,12 @@ if (data.hasOwnProperty('hifiHomeKey')) { if (data.hifiHomeKey.reset === true) { print('FLAMMABLE THING, EXPLODE IT!'); + _this.playSoundAtCurrentPosition(); _this.explodeWithColor(); + _this.smokePuff(); Entities.deleteEntity(otherID) } } - } }, explodeWithColor: function() { @@ -138,13 +141,24 @@ "textures": "atp:/firepit/explode.png", "type": "ParticleEffect", lifetime: 1, - position:myProps.position - } + position: myProps.position + }; + var explosion = Entities.addEntity(explosionParticleProperties); + print('explosion is: ' + explosion) + }, + smokePuff: function() { + //smoke puff here + }, + playSoundAtCurrentPosition: function() { - var explosion = Entities.addEntity(explosionParticleProperties); - print('explosion is: ' + explosion) - } + var audioProperties = { + volume: 0.5, + position: Entities.getEntityProperties(this.entityID).position + }; + + Audio.playSound(this.EXPLOSION_SOUND, audioProperties); + }, } return new Fire();