Spaces:
Running
Running
cutechicken
commited on
Commit
โข
f9ba10f
1
Parent(s):
e44b683
Update game.js
Browse files
game.js
CHANGED
@@ -953,6 +953,8 @@ class Game {
|
|
953 |
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; // ๋ถ๋๋ฌ์ด ๊ทธ๋ฆผ์
|
954 |
this.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
955 |
this.enemyLabels = new Map(); // ์ ๋ผ๋ฒจ์ ์ถ์ ํ๊ธฐ ์ํ Map ์ถ๊ฐ
|
|
|
|
|
956 |
document.getElementById('gameContainer').appendChild(this.renderer.domElement);
|
957 |
|
958 |
|
@@ -1941,6 +1943,17 @@ this.enemies.forEach(enemy => {
|
|
1941 |
}
|
1942 |
}
|
1943 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1944 |
updateEnemyLabels() {
|
1945 |
const labelsContainer = document.getElementById('enemyLabels');
|
1946 |
|
@@ -2019,6 +2032,8 @@ this.enemies.forEach(enemy => {
|
|
2019 |
this.checkCollisions();
|
2020 |
this.updateUI();
|
2021 |
this.updateRadar(); // ๋ ์ด๋ ์
๋ฐ์ดํธ ์ถ๊ฐ
|
|
|
|
|
2022 |
}
|
2023 |
|
2024 |
this.renderer.render(this.scene, this.camera);
|
|
|
953 |
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap; // ๋ถ๋๋ฌ์ด ๊ทธ๋ฆผ์
|
954 |
this.renderer.outputColorSpace = THREE.SRGBColorSpace;
|
955 |
this.enemyLabels = new Map(); // ์ ๋ผ๋ฒจ์ ์ถ์ ํ๊ธฐ ์ํ Map ์ถ๊ฐ
|
956 |
+
this.raycaster = new THREE.Raycaster();
|
957 |
+
this.crosshair = document.getElementById('crosshair');
|
958 |
document.getElementById('gameContainer').appendChild(this.renderer.domElement);
|
959 |
|
960 |
|
|
|
1943 |
}
|
1944 |
}
|
1945 |
}
|
1946 |
+
// ํฌ๋ก์คํค์ด ์
๋ฐ์ดํธ ๋ฉ์๋ ์ถ๊ฐ
|
1947 |
+
updateCrosshair() {
|
1948 |
+
this.raycaster.setFromCamera(new THREE.Vector2(), this.camera);
|
1949 |
+
const intersects = this.raycaster.intersectObjects(this.scene.children, true);
|
1950 |
+
|
1951 |
+
if (intersects.length > 0) {
|
1952 |
+
this.crosshair.classList.add('target-detected');
|
1953 |
+
} else {
|
1954 |
+
this.crosshair.classList.remove('target-detected');
|
1955 |
+
}
|
1956 |
+
}
|
1957 |
updateEnemyLabels() {
|
1958 |
const labelsContainer = document.getElementById('enemyLabels');
|
1959 |
|
|
|
2032 |
this.checkCollisions();
|
2033 |
this.updateUI();
|
2034 |
this.updateRadar(); // ๋ ์ด๋ ์
๋ฐ์ดํธ ์ถ๊ฐ
|
2035 |
+
// ํฌ๋ก์คํค์ด ์
๋ฐ์ดํธ ์ถ๊ฐ
|
2036 |
+
this.updateCrosshair();
|
2037 |
}
|
2038 |
|
2039 |
this.renderer.render(this.scene, this.camera);
|