cutechicken commited on
Commit
7c0fc29
ยท
verified ยท
1 Parent(s): 77524ec

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +10 -0
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