cutechicken commited on
Commit
fa485ff
Β·
verified Β·
1 Parent(s): 825ece5

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +44 -44
game.js CHANGED
@@ -1213,7 +1213,50 @@ class Enemy {
1213
  this.lastPathUpdateTime = 0;
1214
  this.pathUpdateInterval = 1000; // 1μ΄ˆλ§ˆλ‹€ 경둜 μ—…λ°μ΄νŠΈ
1215
  this.moveSpeed = type === 'tank' ? ENEMY_MOVE_SPEED : ENEMY_MOVE_SPEED * 0.7;
1216
- async initialize(loader) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1217
  try {
1218
  // 적 탱크 λͺ¨λΈ λ‘œλ“œ
1219
  let modelPath;
@@ -1258,49 +1301,6 @@ class Enemy {
1258
  this.isLoaded = false;
1259
  }
1260
  }
1261
-
1262
- // AI μƒνƒœ 관리
1263
- this.aiState = {
1264
- mode: 'pursue',
1265
- lastStateChange: 0,
1266
- stateChangeCooldown: 3000,
1267
- lastVisibilityCheck: 0,
1268
- visibilityCheckInterval: 500,
1269
- canSeePlayer: false,
1270
- lastKnownPlayerPosition: null,
1271
- searchStartTime: null,
1272
- targetRotation: 0,
1273
- currentRotation: 0,
1274
- isAiming: false,
1275
- aimingTime: 0,
1276
- requiredAimTime: 1000 // 쑰쀀에 ν•„μš”ν•œ μ‹œκ°„
1277
- };
1278
-
1279
- // 경둜 탐색 및 νšŒν”Ό μ‹œμŠ€ν…œ
1280
- this.pathfinding = {
1281
- currentPath: [],
1282
- pathUpdateInterval: 1000,
1283
- lastPathUpdate: 0,
1284
- isAvoidingObstacle: false,
1285
- avoidanceDirection: null,
1286
- obstacleCheckDistance: 10,
1287
- avoidanceTime: 0,
1288
- maxAvoidanceTime: 3000, // μ΅œλŒ€ νšŒν”Ό μ‹œκ°„
1289
- sensorAngles: [-45, 0, 45], // μ „λ°© 감지 각도
1290
- sensorDistance: 15 // 감지 거리
1291
- };
1292
-
1293
- // μ „νˆ¬ μ‹œμŠ€ν…œ
1294
- this.combat = {
1295
- minEngagementRange: 30,
1296
- maxEngagementRange: 150,
1297
- optimalRange: 80,
1298
- aimThreshold: 0.1, // μ‘°μ€€ 정확도 μž„κ³„κ°’
1299
- lastShotAccuracy: 0,
1300
- consecutiveHits: 0,
1301
- maxConsecutiveHits: 3
1302
- };
1303
- }
1304
 
1305
  // μž₯μ• λ¬Ό 감지 μ‹œμŠ€ν…œ
1306
  detectObstacles() {
 
1213
  this.lastPathUpdateTime = 0;
1214
  this.pathUpdateInterval = 1000; // 1μ΄ˆλ§ˆλ‹€ 경둜 μ—…λ°μ΄νŠΈ
1215
  this.moveSpeed = type === 'tank' ? ENEMY_MOVE_SPEED : ENEMY_MOVE_SPEED * 0.7;
1216
+
1217
+ // AI μƒνƒœ 관리
1218
+ this.aiState = {
1219
+ mode: 'pursue',
1220
+ lastStateChange: 0,
1221
+ stateChangeCooldown: 3000,
1222
+ lastVisibilityCheck: 0,
1223
+ visibilityCheckInterval: 500,
1224
+ canSeePlayer: false,
1225
+ lastKnownPlayerPosition: null,
1226
+ searchStartTime: null,
1227
+ targetRotation: 0,
1228
+ currentRotation: 0,
1229
+ isAiming: false,
1230
+ aimingTime: 0,
1231
+ requiredAimTime: 1000 // 쑰쀀에 ν•„μš”ν•œ μ‹œκ°„
1232
+ };
1233
+
1234
+ // 경둜 탐색 및 νšŒν”Ό μ‹œμŠ€ν…œ
1235
+ this.pathfinding = {
1236
+ currentPath: [],
1237
+ pathUpdateInterval: 1000,
1238
+ lastPathUpdate: 0,
1239
+ isAvoidingObstacle: false,
1240
+ avoidanceDirection: null,
1241
+ obstacleCheckDistance: 10,
1242
+ avoidanceTime: 0,
1243
+ maxAvoidanceTime: 3000, // μ΅œλŒ€ νšŒν”Ό μ‹œκ°„
1244
+ sensorAngles: [-45, 0, 45], // μ „λ°© 감지 각도
1245
+ sensorDistance: 15 // 감지 거리
1246
+ };
1247
+
1248
+ // μ „νˆ¬ μ‹œμŠ€ν…œ
1249
+ this.combat = {
1250
+ minEngagementRange: 30,
1251
+ maxEngagementRange: 150,
1252
+ optimalRange: 80,
1253
+ aimThreshold: 0.1, // μ‘°μ€€ 정확도 μž„κ³„κ°’
1254
+ lastShotAccuracy: 0,
1255
+ consecutiveHits: 0,
1256
+ maxConsecutiveHits: 3
1257
+ };
1258
+ }
1259
+ async initialize(loader) {
1260
  try {
1261
  // 적 탱크 λͺ¨λΈ λ‘œλ“œ
1262
  let modelPath;
 
1301
  this.isLoaded = false;
1302
  }
1303
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1304
 
1305
  // μž₯μ• λ¬Ό 감지 μ‹œμŠ€ν…œ
1306
  detectObstacles() {