diff --git a/72d6a2a3kc.js b/72d6a2a3kc.js index 19404b9..293cd4c 100644 --- a/72d6a2a3kc.js +++ b/72d6a2a3kc.js @@ -12,6 +12,8 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.parcel = this.entityLoaded.parcel; this.santa = this.entityLoaded.santa; this.renderer = this.entityLoaded.renderer; + this.raycaster = this.entityLoaded.raycaster; + this.toBlack = new THREE.Color(0.05, 0.05, 0.05); this.bull.instance.visible = false; this.star.instance.visible = false; @@ -164,11 +166,41 @@ this.totalTime += data.delta; this.spawnTime += data.delta; if (this.mouseIsDown) { + this.renderer.clearColor.r += 0.01; if (this.renderer.clearColor.r > 1) { this.renderer.clearColor.r = 1; } this.renderer.updateInstance('clearColor'); + + var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes); + intersects.map( + function(intersect) { + + var mesh = intersect.mesh; + + if ( + mesh.id !== 'ykfzwmaw9j' && //crosshair + mesh.id !== 't3uije6lwm' && //floor + mesh.id !== 'x4rhvbj8cn' && //flamethrower + mesh.id !== 'xztyfgwq7i' && //skybox + mesh.name.indexOf('Stone') === -1 //stones + ) { + + if (mesh.instance.material instanceof Array) { + mesh.instance.material.map( + function(material) { + material.color.sub(this.toBlack); + } + ); + } else { + mesh.instance.material.color.sub(this.toBlack); + } + + } + }.bind(this) + ); + } else { this.renderer.clearColor.r -= 0.01; if (this.renderer.clearColor.r < 0) {