Spaces:
Running
Running
Update index.html
Browse files- index.html +120 -0
index.html
CHANGED
|
@@ -1040,9 +1040,129 @@
|
|
| 1040 |
threat.style.top = `${y}px`;
|
| 1041 |
|
| 1042 |
rwrThreats.appendChild(threat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1043 |
}
|
| 1044 |
});
|
| 1045 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1046 |
}
|
| 1047 |
|
| 1048 |
// startGame ํจ์ ์ ์
|
|
|
|
| 1040 |
threat.style.top = `${y}px`;
|
| 1041 |
|
| 1042 |
rwrThreats.appendChild(threat);
|
| 1043 |
+
|
| 1044 |
+
// ๋ฝ์จ ์ค์ธ ์ ์ด๋ฉด RWR์ ๋ฐฉํฅ์ ํ์
|
| 1045 |
+
if (enemy.isLocking && enemy.lockTarget === fighter) {
|
| 1046 |
+
const lockLine = document.createElement('div');
|
| 1047 |
+
lockLine.className = 'rwr-lock-line';
|
| 1048 |
+
|
| 1049 |
+
// ์ค์์์ ์ ๊น์ง์ ์
|
| 1050 |
+
const lineLength = Math.sqrt(Math.pow(x - 100, 2) + Math.pow(y - 100, 2));
|
| 1051 |
+
const lineAngle = Math.atan2(y - 100, x - 100);
|
| 1052 |
+
|
| 1053 |
+
lockLine.style.width = `${lineLength}px`;
|
| 1054 |
+
lockLine.style.left = '100px';
|
| 1055 |
+
lockLine.style.top = '100px';
|
| 1056 |
+
lockLine.style.transform = `rotate(${lineAngle}rad)`;
|
| 1057 |
+
|
| 1058 |
+
rwrThreats.appendChild(lockLine);
|
| 1059 |
+
}
|
| 1060 |
}
|
| 1061 |
});
|
| 1062 |
}
|
| 1063 |
+
|
| 1064 |
+
// ๋ฝ์จ ๊ฒฝ๊ณ ํ์ดํ ์
๋ฐ์ดํธ
|
| 1065 |
+
updateLockWarningArrows(fighter);
|
| 1066 |
+
|
| 1067 |
+
// ๋ฏธ์ฌ์ผ ๊ฑฐ๋ฆฌ ๊ฒฝ๊ณ ์
๋ฐ์ดํธ
|
| 1068 |
+
updateMissileWarnings(fighter);
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
// ๋ฝ์จ ๊ฒฝ๊ณ ํ์ดํ ํ์
|
| 1072 |
+
function updateLockWarningArrows(fighter) {
|
| 1073 |
+
// ๊ธฐ์กด ํ์ดํ ์ ๊ฑฐ
|
| 1074 |
+
const existingArrows = document.querySelectorAll('.lock-warning-arrow');
|
| 1075 |
+
existingArrows.forEach(arrow => arrow.remove());
|
| 1076 |
+
|
| 1077 |
+
if (!fighter.beingLockedBy || fighter.beingLockedBy.length === 0) return;
|
| 1078 |
+
|
| 1079 |
+
fighter.beingLockedBy.forEach(enemy => {
|
| 1080 |
+
if (!enemy.position) return;
|
| 1081 |
+
|
| 1082 |
+
// ํ๋ฉด ๋ฐ์ ์๋ ์ ๋ง ํ์ดํ ํ์
|
| 1083 |
+
const screenPos = getScreenPosition(enemy.position);
|
| 1084 |
+
if (screenPos) return; // ํ๋ฉด ์์ ์์ผ๋ฉด ํ์ดํ ๋ถํ์
|
| 1085 |
+
|
| 1086 |
+
// ์๋ ์์น ๊ณ์ฐ
|
| 1087 |
+
const relativePos = enemy.position.clone().sub(fighter.position);
|
| 1088 |
+
const angle = Math.atan2(relativePos.x, relativePos.z) - fighter.rotation.y;
|
| 1089 |
+
|
| 1090 |
+
const arrow = document.createElement('div');
|
| 1091 |
+
arrow.className = 'lock-warning-arrow';
|
| 1092 |
+
|
| 1093 |
+
// ํ๋ฉด ๊ฐ์ฅ์๋ฆฌ์ ํ์ดํ ๋ฐฐ์น
|
| 1094 |
+
const screenCenterX = window.innerWidth / 2;
|
| 1095 |
+
const screenCenterY = window.innerHeight / 2;
|
| 1096 |
+
const edgeDistance = Math.min(screenCenterX - 100, screenCenterY - 100);
|
| 1097 |
+
|
| 1098 |
+
const arrowX = screenCenterX + Math.sin(angle) * edgeDistance;
|
| 1099 |
+
const arrowY = screenCenterY - Math.cos(angle) * edgeDistance;
|
| 1100 |
+
|
| 1101 |
+
arrow.style.left = `${arrowX}px`;
|
| 1102 |
+
arrow.style.top = `${arrowY}px`;
|
| 1103 |
+
|
| 1104 |
+
// ํ์ดํ ํ์
|
| 1105 |
+
const rotationAngle = angle * (180 / Math.PI);
|
| 1106 |
+
arrow.style.transform = `translate(-50%, -50%) rotate(${rotationAngle}deg)`;
|
| 1107 |
+
|
| 1108 |
+
document.body.appendChild(arrow);
|
| 1109 |
+
});
|
| 1110 |
+
}
|
| 1111 |
+
|
| 1112 |
+
// ๋ฏธ์ฌ์ผ ๊ฑฐ๋ฆฌ ๊ฒฝ๊ณ ํ์
|
| 1113 |
+
function updateMissileWarnings(fighter) {
|
| 1114 |
+
// ๊ธฐ์กด ๊ฒฝ๊ณ ํจ๋ ์ ๊ฑฐ
|
| 1115 |
+
const existingPanel = document.querySelector('.missile-warning-panel');
|
| 1116 |
+
if (existingPanel) existingPanel.remove();
|
| 1117 |
+
|
| 1118 |
+
if (!fighter.incomingMissiles || fighter.incomingMissiles.length === 0) return;
|
| 1119 |
+
|
| 1120 |
+
const panel = document.createElement('div');
|
| 1121 |
+
panel.className = 'missile-warning-panel';
|
| 1122 |
+
|
| 1123 |
+
fighter.incomingMissiles.forEach((missile, index) => {
|
| 1124 |
+
if (!missile.position) return;
|
| 1125 |
+
|
| 1126 |
+
const distance = Math.round(fighter.position.distanceTo(missile.position));
|
| 1127 |
+
|
| 1128 |
+
const warningItem = document.createElement('div');
|
| 1129 |
+
warningItem.className = 'missile-warning-item';
|
| 1130 |
+
warningItem.textContent = `MISSILE ${index + 1}: ${distance}m`;
|
| 1131 |
+
|
| 1132 |
+
// ๊ฑฐ๋ฆฌ์ ๋ฐ๋ฅธ ์์ ๊ฐ์กฐ
|
| 1133 |
+
if (distance < 500) {
|
| 1134 |
+
warningItem.style.fontSize = '20px';
|
| 1135 |
+
warningItem.style.color = '#ff0000';
|
| 1136 |
+
warningItem.style.textShadow = '0 0 10px #ff0000, 0 0 20px #ff0000';
|
| 1137 |
+
} else if (distance < 1000) {
|
| 1138 |
+
warningItem.style.fontSize = '18px';
|
| 1139 |
+
}
|
| 1140 |
+
|
| 1141 |
+
panel.appendChild(warningItem);
|
| 1142 |
+
});
|
| 1143 |
+
|
| 1144 |
+
document.body.appendChild(panel);
|
| 1145 |
+
}
|
| 1146 |
+
|
| 1147 |
+
// 3D ์์น๋ฅผ ํ๋ฉด ์ขํ๋ก ๋ณํํ๋ ํฌํผ ํจ์
|
| 1148 |
+
function getScreenPosition(worldPosition) {
|
| 1149 |
+
if (!window.gameInstance || !window.gameInstance.camera) return null;
|
| 1150 |
+
|
| 1151 |
+
const vector = worldPosition.clone();
|
| 1152 |
+
vector.project(window.gameInstance.camera);
|
| 1153 |
+
|
| 1154 |
+
// ์นด๋ฉ๋ผ ๋ค์ ์๋ ๊ฐ์ฒด๋ null ๋ฐํ
|
| 1155 |
+
if (vector.z > 1) return null;
|
| 1156 |
+
|
| 1157 |
+
const x = (vector.x * 0.5 + 0.5) * window.innerWidth;
|
| 1158 |
+
const y = (-vector.y * 0.5 + 0.5) * window.innerHeight;
|
| 1159 |
+
|
| 1160 |
+
// ํ๋ฉด ๋ฐ์ ์์ผ๋ฉด null ๋ฐํ
|
| 1161 |
+
if (x < 0 || x > window.innerWidth || y < 0 || y > window.innerHeight) {
|
| 1162 |
+
return null;
|
| 1163 |
+
}
|
| 1164 |
+
|
| 1165 |
+
return { x, y };
|
| 1166 |
}
|
| 1167 |
|
| 1168 |
// startGame ํจ์ ์ ์
|