cutechicken commited on
Commit
6a99267
โ€ข
1 Parent(s): 2ce947b

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +21 -21
game.js CHANGED
@@ -547,7 +547,7 @@ class Game {
547
  this.initialize();
548
  }
549
 
550
- async initialize() {
551
  try {
552
  // ์•ˆ๊ฐœ ํšจ๊ณผ ์ œ๊ฑฐ
553
  this.scene.fog = null;
@@ -571,31 +571,32 @@ class Game {
571
  color: 0xD2B48C,
572
  roughness: 0.8,
573
  metalness: 0.2,
 
574
  });
 
575
  const ground = new THREE.Mesh(groundGeometry, groundMaterial);
576
  ground.rotation.x = -Math.PI / 2;
577
  ground.receiveShadow = true;
578
 
579
- // ์ง€ํ˜• ๋†’์ด ์„ค์ • (๊ธฐ์กด ์ง€ํ˜• ์ˆ˜์ • ์ฝ”๋“œ ํฌํ•จ)
580
- const vertices = ground.geometry.attributes.position.array;
581
- const heightScale = 15; // ๋†’์ด ์Šค์ผ€์ผ
582
- const baseFrequency = 0.008; // ๊ธฐ๋ณธ ์ฃผํŒŒ์ˆ˜
583
- for (let i = 0; i < vertices.length; i += 3) {
584
- const x = vertices[i];
585
- const z = vertices[i + 1];
586
- const height = Math.sin(x * baseFrequency) * Math.cos(z * baseFrequency) * heightScale;
587
- vertices[i + 2] = height;
588
- }
589
- ground.geometry.attributes.position.needsUpdate = true;
590
- ground.geometry.computeVertexNormals();
591
-
592
- // EdgesGeometry๋กœ ์„  ์ถ”๊ฐ€
593
- const edgesGeometry = new THREE.EdgesGeometry(ground.geometry);
594
- const lineMaterial = new THREE.LineBasicMaterial({ color: 0x000000, linewidth: 1 });
595
- const contourLines = new THREE.LineSegments(edgesGeometry, lineMaterial);
596
 
597
- // ์ง€ํ˜• ๋ฐ ์„  ์ถ”๊ฐ€
598
- this.scene.add(ground);
 
 
 
 
 
 
 
 
 
599
  this.scene.add(contourLines);
600
 
601
  // ๋” ๋‹ค์–‘ํ•œ ์ง€ํ˜• ์ƒ์„ฑ
@@ -669,7 +670,6 @@ class Game {
669
  }
670
  }
671
 
672
-
673
  // ๋ ˆ์ด๋” ์—…๋ฐ์ดํŠธ ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€
674
  updateRadar() {
675
  const currentTime = Date.now();
 
547
  this.initialize();
548
  }
549
 
550
+ async initialize() {
551
  try {
552
  // ์•ˆ๊ฐœ ํšจ๊ณผ ์ œ๊ฑฐ
553
  this.scene.fog = null;
 
571
  color: 0xD2B48C,
572
  roughness: 0.8,
573
  metalness: 0.2,
574
+ wireframe: false
575
  });
576
+
577
  const ground = new THREE.Mesh(groundGeometry, groundMaterial);
578
  ground.rotation.x = -Math.PI / 2;
579
  ground.receiveShadow = true;
580
 
581
+ // ๊ฒฉ์ž ํšจ๊ณผ๋ฅผ ์œ„ํ•œ ๋ผ์ธ ์ถ”๊ฐ€
582
+ const gridSize = 50; // ๊ฒฉ์ž ํฌ๊ธฐ
583
+ const gridHelper = new THREE.GridHelper(MAP_SIZE, gridSize, 0x000000, 0x000000);
584
+ gridHelper.material.opacity = 0.1;
585
+ gridHelper.material.transparent = true;
586
+ gridHelper.position.y = 0.1; // ์ง€๋ฉด๋ณด๋‹ค ์•ฝ๊ฐ„ ์œ„์— ๋ฐฐ์น˜
587
+ this.scene.add(gridHelper);
 
 
 
 
 
 
 
 
 
 
588
 
589
+ // ๋“ฑ๊ณ ์„  ํšจ๊ณผ๋ฅผ ์œ„ํ•œ ์ง€ํ˜• ์ปจํˆฌ์–ด
590
+ const contourLines = new THREE.LineSegments(
591
+ new THREE.EdgesGeometry(groundGeometry),
592
+ new THREE.LineBasicMaterial({
593
+ color: 0x000000,
594
+ opacity: 0.15,
595
+ transparent: true
596
+ })
597
+ );
598
+ contourLines.rotation.x = -Math.PI / 2;
599
+ contourLines.position.y = 0.1;
600
  this.scene.add(contourLines);
601
 
602
  // ๋” ๋‹ค์–‘ํ•œ ์ง€ํ˜• ์ƒ์„ฑ
 
670
  }
671
  }
672
 
 
673
  // ๋ ˆ์ด๋” ์—…๋ฐ์ดํŠธ ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€
674
  updateRadar() {
675
  const currentTime = Date.now();