Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
|
@@ -1411,24 +1411,31 @@ class AIM9Missile {
|
|
| 1411 |
this.isLoaded = true;
|
| 1412 |
}
|
| 1413 |
|
| 1414 |
-
|
| 1415 |
-
update(deltaTime, playerPosition) {
|
| 1416 |
if (!this.mesh || !this.target || !this.target.position) {
|
| 1417 |
this.destroy();
|
| 1418 |
return 'expired';
|
| 1419 |
}
|
| 1420 |
|
| 1421 |
-
// *** νλ μ΄ νμ§ λ‘μ§
|
| 1422 |
-
// νλ μ΄ νμ§ λ° λͺ©ν λ³κ²½
|
| 1423 |
if (window.gameInstance && !this.isTargetingFlare) {
|
| 1424 |
const nearestFlare = window.gameInstance.findNearestFlare(this.position);
|
| 1425 |
if (nearestFlare) {
|
| 1426 |
const flareDistance = this.position.distanceTo(nearestFlare.position);
|
| 1427 |
-
|
| 1428 |
-
|
| 1429 |
-
|
|
|
|
| 1430 |
this.target = nearestFlare;
|
| 1431 |
this.isTargetingFlare = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1432 |
}
|
| 1433 |
}
|
| 1434 |
}
|
|
@@ -1757,10 +1764,23 @@ class EnemyAIM9Missile {
|
|
| 1757 |
}
|
| 1758 |
|
| 1759 |
update(deltaTime, enemyPosition) {
|
| 1760 |
-
|
| 1761 |
-
|
| 1762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1763 |
}
|
|
|
|
| 1764 |
|
| 1765 |
this.lifeTime -= deltaTime;
|
| 1766 |
if (this.lifeTime <= 0) {
|
|
@@ -3045,19 +3065,33 @@ class Game {
|
|
| 3045 |
}
|
| 3046 |
|
| 3047 |
startGame() {
|
| 3048 |
-
|
| 3049 |
-
|
| 3050 |
-
|
| 3051 |
-
}
|
| 3052 |
-
|
| 3053 |
-
this.isStarted = true;
|
| 3054 |
-
this.startGameTimer();
|
| 3055 |
-
|
| 3056 |
-
// μμ§ μ리 μμ
|
| 3057 |
-
this.fighter.startEngineSound();
|
| 3058 |
-
|
| 3059 |
-
console.log('κ²μ μμ!');
|
| 3060 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3061 |
|
| 3062 |
startBGM() {
|
| 3063 |
if (this.bgmPlaying || !this.bgm) return;
|
|
|
|
| 1411 |
this.isLoaded = true;
|
| 1412 |
}
|
| 1413 |
|
| 1414 |
+
update(deltaTime, playerPosition) {
|
|
|
|
| 1415 |
if (!this.mesh || !this.target || !this.target.position) {
|
| 1416 |
this.destroy();
|
| 1417 |
return 'expired';
|
| 1418 |
}
|
| 1419 |
|
| 1420 |
+
// *** κ°νλ νλ μ΄ νμ§ λ‘μ§ ***
|
| 1421 |
+
// νλ μ΄ νμ§ λ° λͺ©ν λ³κ²½ - 100% μ±κ³΅λ₯
|
| 1422 |
if (window.gameInstance && !this.isTargetingFlare) {
|
| 1423 |
const nearestFlare = window.gameInstance.findNearestFlare(this.position);
|
| 1424 |
if (nearestFlare) {
|
| 1425 |
const flareDistance = this.position.distanceTo(nearestFlare.position);
|
| 1426 |
+
// νμ§ κ±°λ¦¬λ₯Ό 1000mλ‘ νλνκ³ μ΄ μ νΈ μ‘°κ±΄ μ κ±°
|
| 1427 |
+
if (flareDistance < 1000) {
|
| 1428 |
+
// νλ μ΄λ‘ λͺ©ν λ³κ²½ - 100% μ±κ³΅
|
| 1429 |
+
console.log('Missile redirected to flare! Distance:', flareDistance);
|
| 1430 |
this.target = nearestFlare;
|
| 1431 |
this.isTargetingFlare = true;
|
| 1432 |
+
|
| 1433 |
+
// νλ μ΄ κΈ°λ§ μ±κ³΅ μ¬μ΄λ μ¬μ
|
| 1434 |
+
try {
|
| 1435 |
+
const evadeSound = new Audio('sounds/missileswing3.ogg');
|
| 1436 |
+
evadeSound.volume = 0.6;
|
| 1437 |
+
evadeSound.play().catch(e => {});
|
| 1438 |
+
} catch (e) {}
|
| 1439 |
}
|
| 1440 |
}
|
| 1441 |
}
|
|
|
|
| 1764 |
}
|
| 1765 |
|
| 1766 |
update(deltaTime, enemyPosition) {
|
| 1767 |
+
if (!this.mesh || !this.target || !this.target.position) {
|
| 1768 |
+
this.destroy();
|
| 1769 |
+
return 'expired';
|
| 1770 |
+
}
|
| 1771 |
+
|
| 1772 |
+
// *** κ°νλ νλ μ΄ νμ§ λ‘μ§ ***
|
| 1773 |
+
if (window.gameInstance && !this.isTargetingFlare) {
|
| 1774 |
+
const nearestFlare = window.gameInstance.findNearestFlare(this.position);
|
| 1775 |
+
if (nearestFlare) {
|
| 1776 |
+
const flareDistance = this.position.distanceTo(nearestFlare.position);
|
| 1777 |
+
if (flareDistance < 1000) {
|
| 1778 |
+
console.log('Enemy missile redirected to flare!');
|
| 1779 |
+
this.target = nearestFlare;
|
| 1780 |
+
this.isTargetingFlare = true;
|
| 1781 |
+
}
|
| 1782 |
}
|
| 1783 |
+
}
|
| 1784 |
|
| 1785 |
this.lifeTime -= deltaTime;
|
| 1786 |
if (this.lifeTime <= 0) {
|
|
|
|
| 3065 |
}
|
| 3066 |
|
| 3067 |
startGame() {
|
| 3068 |
+
if (!this.isLoaded) {
|
| 3069 |
+
console.log('κ²μμ΄ μμ§ λ‘λ© μ€μ
λλ€...');
|
| 3070 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3071 |
}
|
| 3072 |
+
|
| 3073 |
+
this.isStarted = true;
|
| 3074 |
+
this.startGameTimer();
|
| 3075 |
+
|
| 3076 |
+
// μμ§ μ리 μμ
|
| 3077 |
+
this.fighter.startEngineSound();
|
| 3078 |
+
|
| 3079 |
+
// κ²μ μμ μμ± μ¬μ
|
| 3080 |
+
try {
|
| 3081 |
+
const startVoice = new Audio('sounds/voice_start_a.ogg');
|
| 3082 |
+
startVoice.volume = 0.8;
|
| 3083 |
+
startVoice.play().catch(e => {
|
| 3084 |
+
console.log('Start voice failed to play:', e);
|
| 3085 |
+
});
|
| 3086 |
+
} catch (e) {
|
| 3087 |
+
console.log('Start voice error:', e);
|
| 3088 |
+
}
|
| 3089 |
+
|
| 3090 |
+
// μλ§ νμ
|
| 3091 |
+
this.showSubtitle('Listen up! Find and shut down all enemy squad that invaded their airspace.', 5000);
|
| 3092 |
+
|
| 3093 |
+
console.log('κ²μ μμ!');
|
| 3094 |
+
}
|
| 3095 |
|
| 3096 |
startBGM() {
|
| 3097 |
if (this.bgmPlaying || !this.bgm) return;
|