salomonsky commited on
Commit
b300f85
·
verified ·
1 Parent(s): 22ec77f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +55 -0
index.html CHANGED
@@ -283,6 +283,7 @@
283
  let bgParticles;
284
 
285
  let meteors, meteorGeo;
 
286
 
287
  let db, auth, analytics, userId = null, appId = "neuronal-1f3b9", userProfile = null;
288
  let userMaps = {}, userProfileCache = {};
@@ -367,9 +368,11 @@
367
  if(mode === 'bridge') {
368
  bridgeCtrl.classList.remove('hidden');
369
  actBtn.innerText = "CONSTRUIR NODO";
 
370
  } else {
371
  bridgeCtrl.classList.add('hidden');
372
  actBtn.innerText = "EJECUTAR ANÁLISIS";
 
373
  }
374
 
375
  if(mode === 'comet') {
@@ -691,6 +694,48 @@
691
  meteors.geometry.attributes.position.needsUpdate = true;
692
  }
693
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
  function updateHUD() {
695
  document.getElementById('energyBar').style.width = gameState.energy + '%';
696
  document.getElementById('rankDisplay').innerText = gameState.rank;
@@ -892,6 +937,13 @@
892
  drawMinimap();
893
  if(gameState.mode === 'miner') updateMeteors();
894
 
 
 
 
 
 
 
 
895
  hashtagGroup.children.forEach(obj => {
896
  if (obj.userData.isText) {
897
  obj.lookAt(camera.position);
@@ -1228,6 +1280,9 @@
1228
  initAdvancedComet();
1229
  drawMinimap();
1230
  focusOnUserMaps();
 
 
 
1231
  });
1232
  }
1233
 
 
283
  let bgParticles;
284
 
285
  let meteors, meteorGeo;
286
+ let bridgeLasersGroup;
287
 
288
  let db, auth, analytics, userId = null, appId = "neuronal-1f3b9", userProfile = null;
289
  let userMaps = {}, userProfileCache = {};
 
368
  if(mode === 'bridge') {
369
  bridgeCtrl.classList.remove('hidden');
370
  actBtn.innerText = "CONSTRUIR NODO";
371
+ updateBridgeConnections();
372
  } else {
373
  bridgeCtrl.classList.add('hidden');
374
  actBtn.innerText = "EJECUTAR ANÁLISIS";
375
+ if(bridgeLasersGroup) bridgeLasersGroup.visible = false;
376
  }
377
 
378
  if(mode === 'comet') {
 
694
  meteors.geometry.attributes.position.needsUpdate = true;
695
  }
696
 
697
+ function updateBridgeConnections() {
698
+ if(bridgeLasersGroup) scene.remove(bridgeLasersGroup);
699
+ if(gameState.mode !== 'bridge') return;
700
+
701
+ bridgeLasersGroup = new THREE.Group();
702
+ const centroids = [];
703
+
704
+ Object.keys(userMaps).forEach(uid => {
705
+ const origins = userMaps[uid];
706
+ if(origins && origins.length > 0) {
707
+ const c = new THREE.Vector3();
708
+ origins.forEach(p=>c.add(p));
709
+ c.divideScalar(origins.length);
710
+ centroids.push(c);
711
+ }
712
+ });
713
+
714
+ if(centroids.length > 1) {
715
+ const points = [];
716
+ for(let i = 0; i < centroids.length; i++) {
717
+ for(let j = i + 1; j < centroids.length; j++) {
718
+ points.push(centroids[i]);
719
+ points.push(centroids[j]);
720
+ }
721
+ }
722
+ if(points.length > 0) {
723
+ const geometry = new THREE.BufferGeometry().setFromPoints(points);
724
+ const material = new THREE.LineBasicMaterial({
725
+ color: 0xa855f7,
726
+ transparent: true,
727
+ opacity: 0.6,
728
+ blending: THREE.AdditiveBlending,
729
+ linewidth: 2
730
+ });
731
+ const lines = new THREE.LineSegments(geometry, material);
732
+ bridgeLasersGroup.add(lines);
733
+ }
734
+ }
735
+
736
+ scene.add(bridgeLasersGroup);
737
+ }
738
+
739
  function updateHUD() {
740
  document.getElementById('energyBar').style.width = gameState.energy + '%';
741
  document.getElementById('rankDisplay').innerText = gameState.rank;
 
937
  drawMinimap();
938
  if(gameState.mode === 'miner') updateMeteors();
939
 
940
+ if(gameState.mode === 'bridge' && bridgeLasersGroup) {
941
+ const pulse = (Math.sin(time * 5) * 0.5 + 0.5) * 0.4 + 0.2;
942
+ bridgeLasersGroup.children.forEach(c => {
943
+ if(c.material) c.material.opacity = pulse;
944
+ });
945
+ }
946
+
947
  hashtagGroup.children.forEach(obj => {
948
  if (obj.userData.isText) {
949
  obj.lookAt(camera.position);
 
1280
  initAdvancedComet();
1281
  drawMinimap();
1282
  focusOnUserMaps();
1283
+
1284
+ // Refrescar láseres si estamos en modo puente
1285
+ if(gameState.mode === 'bridge') updateBridgeConnections();
1286
  });
1287
  }
1288