Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
|
@@ -590,6 +590,7 @@ class Enemy {
|
|
| 590 |
this.lastPathUpdateTime = 0;
|
| 591 |
this.pathUpdateInterval = 3000; // 3์ด๋ง๋ค ๊ฒฝ๋ก ์
๋ฐ์ดํธ
|
| 592 |
this.moveSpeed = type === 'tank' ? ENEMY_MOVE_SPEED : ENEMY_MOVE_SPEED * 0.7;
|
|
|
|
| 593 |
|
| 594 |
// AI ์ํ ๊ด๋ฆฌ
|
| 595 |
this.aiState = {
|
|
@@ -739,6 +740,15 @@ class Enemy {
|
|
| 739 |
update(playerPosition) {
|
| 740 |
if (!this.mesh || !this.isLoaded) return;
|
| 741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 742 |
// AI ์ํ ์
๋ฐ์ดํธ
|
| 743 |
this.updateAIState(playerPosition);
|
| 744 |
|
|
|
|
| 590 |
this.lastPathUpdateTime = 0;
|
| 591 |
this.pathUpdateInterval = 3000; // 3์ด๋ง๋ค ๊ฒฝ๋ก ์
๋ฐ์ดํธ
|
| 592 |
this.moveSpeed = type === 'tank' ? ENEMY_MOVE_SPEED : ENEMY_MOVE_SPEED * 0.7;
|
| 593 |
+
this.hasPlayedWarning = false; // ๊ฒฝ๊ณ ์ ์ฌ์ ์ฌ๋ถ ์ถ์
|
| 594 |
|
| 595 |
// AI ์ํ ๊ด๋ฆฌ
|
| 596 |
this.aiState = {
|
|
|
|
| 740 |
update(playerPosition) {
|
| 741 |
if (!this.mesh || !this.isLoaded) return;
|
| 742 |
|
| 743 |
+
// ํ๋ ์ด์ด์์ ๊ฑฐ๋ฆฌ ์ฒดํฌ ๋ฐ ๊ฒฝ๊ณ ์ ์ฌ์
|
| 744 |
+
const distanceToPlayer = this.mesh.position.distanceTo(playerPosition);
|
| 745 |
+
if (!this.hasPlayedWarning && distanceToPlayer <= ENEMY_CONFIG.ATTACK_RANGE) {
|
| 746 |
+
const warningSound = new Audio('sounds/warning.ogg');
|
| 747 |
+
warningSound.volume = 0.5;
|
| 748 |
+
warningSound.play();
|
| 749 |
+
this.hasPlayedWarning = true;
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
// AI ์ํ ์
๋ฐ์ดํธ
|
| 753 |
this.updateAIState(playerPosition);
|
| 754 |
|