Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
@@ -658,8 +658,6 @@ class Fighter {
|
|
658 |
const bulletGeometry = new THREE.CylinderGeometry(1.0, 1.0, 16, 8); // λ°μ§λ¦ 0.75β1.0, κΈΈμ΄ 12β16
|
659 |
const bulletMaterial = new THREE.MeshBasicMaterial({
|
660 |
color: 0xffff00,
|
661 |
-
emissive: 0xffff00,
|
662 |
-
emissiveIntensity: 1.0
|
663 |
});
|
664 |
const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
|
665 |
|
@@ -1372,8 +1370,6 @@ class EnemyFighter {
|
|
1372 |
const bulletGeometry = new THREE.CylinderGeometry(1.0, 1.0, 16, 8);
|
1373 |
const bulletMaterial = new THREE.MeshBasicMaterial({
|
1374 |
color: 0xff0000,
|
1375 |
-
emissive: 0xff0000,
|
1376 |
-
emissiveIntensity: 1.0
|
1377 |
});
|
1378 |
const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
|
1379 |
|
@@ -2331,8 +2327,6 @@ class Game {
|
|
2331 |
const flashGeometry = new THREE.SphereGeometry(3, 8, 8);
|
2332 |
const flashMaterial = new THREE.MeshBasicMaterial({
|
2333 |
color: 0xffaa00,
|
2334 |
-
emissive: 0xffaa00,
|
2335 |
-
emissiveIntensity: 2.0,
|
2336 |
transparent: true,
|
2337 |
opacity: 0.8
|
2338 |
});
|
@@ -2351,8 +2345,6 @@ class Game {
|
|
2351 |
const particleGeometry = new THREE.SphereGeometry(0.3 + Math.random() * 0.3, 4, 4);
|
2352 |
const particleMaterial = new THREE.MeshBasicMaterial({
|
2353 |
color: Math.random() > 0.5 ? 0xffaa00 : 0xff6600,
|
2354 |
-
emissive: 0xffaa00,
|
2355 |
-
emissiveIntensity: 1.5,
|
2356 |
transparent: true,
|
2357 |
opacity: 1.0
|
2358 |
});
|
@@ -2578,189 +2570,275 @@ class Game {
|
|
2578 |
});
|
2579 |
}
|
2580 |
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
console.error('Invalid position for explosion effect');
|
2586 |
-
return;
|
2587 |
-
}
|
2588 |
-
|
2589 |
-
console.log('Creating explosion effect at position:', position);
|
2590 |
-
|
2591 |
-
// νλ°μμ κ°μ₯ λ¨Όμ μ¬μ (μκ°ν¨κ³Όλ³΄λ€ μ°μ )
|
2592 |
-
try {
|
2593 |
-
const explosionSound = new Audio('sounds/bang.ogg');
|
2594 |
-
explosionSound.volume = 1.0; // μ΅λ μλ
|
2595 |
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
console.error('Explosion sound failed:', e);
|
2603 |
-
// μ€λμ€ μ»¨ν
μ€νΈ λ¬Έμ μΌ μ μμΌλ―λ‘ μ¬μ©μ μνΈμμ© ν μ¬μλ
|
2604 |
-
document.addEventListener('click', () => {
|
2605 |
-
explosionSound.play().catch(err => console.error('Retry failed:', err));
|
2606 |
-
}, { once: true });
|
2607 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2608 |
}
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
const explosionGeometry = new THREE.SphereGeometry(50, 16, 16);
|
2615 |
-
const explosionMaterial = new THREE.MeshBasicMaterial({
|
2616 |
-
color: 0xffaa00,
|
2617 |
-
emissive: 0xffaa00,
|
2618 |
-
emissiveIntensity: 3.0,
|
2619 |
-
transparent: true,
|
2620 |
-
opacity: 1.0
|
2621 |
-
});
|
2622 |
-
|
2623 |
-
const explosion = new THREE.Mesh(explosionGeometry, explosionMaterial);
|
2624 |
-
explosion.position.copy(position);
|
2625 |
-
this.scene.add(explosion);
|
2626 |
-
|
2627 |
-
// νλ° ννΈλ€
|
2628 |
-
const debrisCount = 30;
|
2629 |
-
const debris = [];
|
2630 |
-
|
2631 |
-
for (let i = 0; i < debrisCount; i++) {
|
2632 |
-
const debrisGeometry = new THREE.BoxGeometry(
|
2633 |
-
2 + Math.random() * 4,
|
2634 |
-
2 + Math.random() * 4,
|
2635 |
-
2 + Math.random() * 4
|
2636 |
-
);
|
2637 |
-
const debrisMaterial = new THREE.MeshBasicMaterial({
|
2638 |
-
color: Math.random() > 0.5 ? 0xff6600 : 0x333333,
|
2639 |
transparent: true,
|
2640 |
-
opacity:
|
2641 |
});
|
2642 |
|
2643 |
-
const
|
2644 |
-
|
|
|
2645 |
|
2646 |
-
//
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2658 |
|
2659 |
-
|
2660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2661 |
}
|
2662 |
-
|
2663 |
-
//
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
color: 0x222222,
|
2671 |
-
transparent: true,
|
2672 |
-
opacity: 0.8
|
2673 |
-
});
|
2674 |
|
2675 |
-
|
2676 |
-
smokePuff.position.copy(position);
|
2677 |
-
smokePuff.position.add(new THREE.Vector3(
|
2678 |
-
(Math.random() - 0.5) * 20,
|
2679 |
-
(Math.random() - 0.5) * 20,
|
2680 |
-
(Math.random() - 0.5) * 20
|
2681 |
-
));
|
2682 |
-
|
2683 |
-
smokePuff.velocity = new THREE.Vector3(
|
2684 |
-
(Math.random() - 0.5) * 50,
|
2685 |
-
Math.random() * 50 + 20,
|
2686 |
-
(Math.random() - 0.5) * 50
|
2687 |
-
);
|
2688 |
-
smokePuff.life = 3.0;
|
2689 |
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
explosion.scale.multiplyScalar(1.08);
|
2704 |
-
allDead = false;
|
2705 |
-
} else if (explosion.parent) {
|
2706 |
-
this.scene.remove(explosion);
|
2707 |
-
}
|
2708 |
-
|
2709 |
-
// ννΈ μ λλ©μ΄μ
|
2710 |
-
debris.forEach(piece => {
|
2711 |
-
if (piece.life > 0) {
|
2712 |
-
allDead = false;
|
2713 |
-
piece.life -= 0.02;
|
2714 |
-
|
2715 |
-
// μμΉ μ
λ°μ΄νΈ
|
2716 |
-
piece.position.add(piece.velocity.clone().multiplyScalar(0.02));
|
2717 |
-
|
2718 |
-
// μ€λ ₯
|
2719 |
-
piece.velocity.y -= 3;
|
2720 |
-
|
2721 |
-
// νμ
|
2722 |
-
piece.rotation.x += piece.rotationSpeed.x * 0.02;
|
2723 |
-
piece.rotation.y += piece.rotationSpeed.y * 0.02;
|
2724 |
-
piece.rotation.z += piece.rotationSpeed.z * 0.02;
|
2725 |
-
|
2726 |
-
// νμ΄λ μμ
|
2727 |
-
piece.material.opacity = piece.life / 2;
|
2728 |
-
} else if (piece.parent) {
|
2729 |
-
this.scene.remove(piece);
|
2730 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2731 |
});
|
2732 |
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2736 |
allDead = false;
|
2737 |
-
|
2738 |
-
|
2739 |
-
// μμΉ μ
λ°μ΄νΈ
|
2740 |
-
puff.position.add(puff.velocity.clone().multiplyScalar(0.02));
|
2741 |
-
|
2742 |
-
// μμΉ κ°μ
|
2743 |
-
puff.velocity.y *= 0.98;
|
2744 |
-
puff.velocity.x *= 0.98;
|
2745 |
-
puff.velocity.z *= 0.98;
|
2746 |
-
|
2747 |
-
// νμ°
|
2748 |
-
puff.scale.multiplyScalar(1.02);
|
2749 |
-
|
2750 |
-
// νμ΄λ μμ
|
2751 |
-
puff.material.opacity = (puff.life / 3) * 0.8;
|
2752 |
-
} else if (puff.parent) {
|
2753 |
-
this.scene.remove(puff);
|
2754 |
}
|
2755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2756 |
|
2757 |
-
|
2758 |
-
|
2759 |
-
}
|
2760 |
-
};
|
2761 |
-
|
2762 |
-
animateExplosion();
|
2763 |
-
}
|
2764 |
|
2765 |
showHitMarker(position) {
|
2766 |
// ννΈ λ§μ»€ div μμ±
|
|
|
658 |
const bulletGeometry = new THREE.CylinderGeometry(1.0, 1.0, 16, 8); // λ°μ§λ¦ 0.75β1.0, κΈΈμ΄ 12β16
|
659 |
const bulletMaterial = new THREE.MeshBasicMaterial({
|
660 |
color: 0xffff00,
|
|
|
|
|
661 |
});
|
662 |
const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
|
663 |
|
|
|
1370 |
const bulletGeometry = new THREE.CylinderGeometry(1.0, 1.0, 16, 8);
|
1371 |
const bulletMaterial = new THREE.MeshBasicMaterial({
|
1372 |
color: 0xff0000,
|
|
|
|
|
1373 |
});
|
1374 |
const bullet = new THREE.Mesh(bulletGeometry, bulletMaterial);
|
1375 |
|
|
|
2327 |
const flashGeometry = new THREE.SphereGeometry(3, 8, 8);
|
2328 |
const flashMaterial = new THREE.MeshBasicMaterial({
|
2329 |
color: 0xffaa00,
|
|
|
|
|
2330 |
transparent: true,
|
2331 |
opacity: 0.8
|
2332 |
});
|
|
|
2345 |
const particleGeometry = new THREE.SphereGeometry(0.3 + Math.random() * 0.3, 4, 4);
|
2346 |
const particleMaterial = new THREE.MeshBasicMaterial({
|
2347 |
color: Math.random() > 0.5 ? 0xffaa00 : 0xff6600,
|
|
|
|
|
2348 |
transparent: true,
|
2349 |
opacity: 1.0
|
2350 |
});
|
|
|
2570 |
});
|
2571 |
}
|
2572 |
|
2573 |
+
createHitEffect(position) {
|
2574 |
+
// νΌκ²© νν°ν΄ ν¨κ³Ό μμ±
|
2575 |
+
const particleCount = 15;
|
2576 |
+
const particles = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2577 |
|
2578 |
+
for (let i = 0; i < particleCount; i++) {
|
2579 |
+
const particleGeometry = new THREE.SphereGeometry(0.5, 4, 4);
|
2580 |
+
const particleMaterial = new THREE.MeshBasicMaterial({
|
2581 |
+
color: Math.random() > 0.5 ? 0xffaa00 : 0xff6600,
|
2582 |
+
transparent: true,
|
2583 |
+
opacity: 1.0
|
|
|
|
|
|
|
|
|
|
|
2584 |
});
|
2585 |
+
|
2586 |
+
const particle = new THREE.Mesh(particleGeometry, particleMaterial);
|
2587 |
+
particle.position.copy(position);
|
2588 |
+
|
2589 |
+
// λλ€ μλ μ€μ
|
2590 |
+
particle.velocity = new THREE.Vector3(
|
2591 |
+
(Math.random() - 0.5) * 100,
|
2592 |
+
(Math.random() - 0.5) * 100,
|
2593 |
+
(Math.random() - 0.5) * 100
|
2594 |
+
);
|
2595 |
+
|
2596 |
+
particle.life = 1.0; // 1μ΄ λμ μ§μ
|
2597 |
+
|
2598 |
+
this.scene.add(particle);
|
2599 |
+
particles.push(particle);
|
2600 |
}
|
2601 |
+
|
2602 |
+
// μ€μ νλ° νλμ
|
2603 |
+
const flashGeometry = new THREE.SphereGeometry(5, 8, 8);
|
2604 |
+
const flashMaterial = new THREE.MeshBasicMaterial({
|
2605 |
+
color: 0xffff00,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2606 |
transparent: true,
|
2607 |
+
opacity: 0.8
|
2608 |
});
|
2609 |
|
2610 |
+
const flash = new THREE.Mesh(flashGeometry, flashMaterial);
|
2611 |
+
flash.position.copy(position);
|
2612 |
+
this.scene.add(flash);
|
2613 |
|
2614 |
+
// νν°ν΄ μ λλ©μ΄μ
|
2615 |
+
const animateParticles = () => {
|
2616 |
+
let allDead = true;
|
2617 |
+
|
2618 |
+
particles.forEach(particle => {
|
2619 |
+
if (particle.life > 0) {
|
2620 |
+
allDead = false;
|
2621 |
+
particle.life -= 0.02;
|
2622 |
+
|
2623 |
+
// μμΉ μ
λ°μ΄νΈ
|
2624 |
+
particle.position.add(particle.velocity.clone().multiplyScalar(0.02));
|
2625 |
+
|
2626 |
+
// μ€λ ₯ ν¨κ³Ό
|
2627 |
+
particle.velocity.y -= 2;
|
2628 |
+
|
2629 |
+
// νμ΄λ μμ
|
2630 |
+
particle.material.opacity = particle.life;
|
2631 |
+
|
2632 |
+
// ν¬κΈ° κ°μ
|
2633 |
+
const scale = particle.life;
|
2634 |
+
particle.scale.set(scale, scale, scale);
|
2635 |
+
} else if (particle.parent) {
|
2636 |
+
this.scene.remove(particle);
|
2637 |
+
}
|
2638 |
+
});
|
2639 |
+
|
2640 |
+
// νλμ ν¨κ³Ό
|
2641 |
+
if (flash.material.opacity > 0) {
|
2642 |
+
flash.material.opacity -= 0.05;
|
2643 |
+
flash.scale.multiplyScalar(1.1);
|
2644 |
+
} else if (flash.parent) {
|
2645 |
+
this.scene.remove(flash);
|
2646 |
+
}
|
2647 |
+
|
2648 |
+
if (!allDead || flash.material.opacity > 0) {
|
2649 |
+
requestAnimationFrame(animateParticles);
|
2650 |
+
}
|
2651 |
+
};
|
2652 |
|
2653 |
+
animateParticles();
|
2654 |
+
|
2655 |
+
// νΌκ²© μ¬μ΄λ μ¬μ
|
2656 |
+
try {
|
2657 |
+
const hitSound = new Audio('sounds/hit.ogg');
|
2658 |
+
hitSound.volume = 0.3;
|
2659 |
+
hitSound.play().catch(e => {
|
2660 |
+
console.log('Hit sound not found or failed to play');
|
2661 |
+
});
|
2662 |
+
} catch (e) {
|
2663 |
+
console.log('Hit sound error:', e);
|
2664 |
+
}
|
2665 |
}
|
2666 |
+
|
2667 |
+
// 2. createExplosionEffect μμ - emissive μμ± μ κ±°
|
2668 |
+
createExplosionEffect(position) {
|
2669 |
+
// μμΉ μ ν¨μ± κ²μ¬
|
2670 |
+
if (!position || position.x === undefined) {
|
2671 |
+
console.error('Invalid position for explosion effect');
|
2672 |
+
return;
|
2673 |
+
}
|
|
|
|
|
|
|
|
|
2674 |
|
2675 |
+
console.log('Creating explosion effect at position:', position);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2676 |
|
2677 |
+
// νλ°μμ κ°μ₯ λ¨Όμ μ¬μ (μκ°ν¨κ³Όλ³΄λ€ μ°μ )
|
2678 |
+
try {
|
2679 |
+
const explosionSound = new Audio('sounds/bang.ogg');
|
2680 |
+
explosionSound.volume = 1.0; // μ΅λ μλ
|
2681 |
+
|
2682 |
+
// μ¦μ μ¬μ μλ
|
2683 |
+
const playPromise = explosionSound.play();
|
2684 |
+
if (playPromise !== undefined) {
|
2685 |
+
playPromise.then(() => {
|
2686 |
+
console.log('Explosion sound played successfully');
|
2687 |
+
}).catch(e => {
|
2688 |
+
console.error('Explosion sound failed:', e);
|
2689 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2690 |
}
|
2691 |
+
} catch (e) {
|
2692 |
+
console.error('Explosion sound error:', e);
|
2693 |
+
}
|
2694 |
+
|
2695 |
+
// λ©μΈ νλ° νλμ
|
2696 |
+
const explosionGeometry = new THREE.SphereGeometry(50, 16, 16);
|
2697 |
+
const explosionMaterial = new THREE.MeshBasicMaterial({
|
2698 |
+
color: 0xffaa00,
|
2699 |
+
transparent: true,
|
2700 |
+
opacity: 1.0
|
2701 |
});
|
2702 |
|
2703 |
+
const explosion = new THREE.Mesh(explosionGeometry, explosionMaterial);
|
2704 |
+
explosion.position.copy(position);
|
2705 |
+
this.scene.add(explosion);
|
2706 |
+
|
2707 |
+
// νλ° ννΈλ€
|
2708 |
+
const debrisCount = 30;
|
2709 |
+
const debris = [];
|
2710 |
+
|
2711 |
+
for (let i = 0; i < debrisCount; i++) {
|
2712 |
+
const debrisGeometry = new THREE.BoxGeometry(
|
2713 |
+
2 + Math.random() * 4,
|
2714 |
+
2 + Math.random() * 4,
|
2715 |
+
2 + Math.random() * 4
|
2716 |
+
);
|
2717 |
+
const debrisMaterial = new THREE.MeshBasicMaterial({
|
2718 |
+
color: Math.random() > 0.5 ? 0xff6600 : 0x333333,
|
2719 |
+
transparent: true,
|
2720 |
+
opacity: 1.0
|
2721 |
+
});
|
2722 |
+
|
2723 |
+
const debrisPiece = new THREE.Mesh(debrisGeometry, debrisMaterial);
|
2724 |
+
debrisPiece.position.copy(position);
|
2725 |
+
|
2726 |
+
// λλ€ μλμ νμ
|
2727 |
+
debrisPiece.velocity = new THREE.Vector3(
|
2728 |
+
(Math.random() - 0.5) * 200,
|
2729 |
+
(Math.random() - 0.5) * 200,
|
2730 |
+
(Math.random() - 0.5) * 200
|
2731 |
+
);
|
2732 |
+
debrisPiece.rotationSpeed = new THREE.Vector3(
|
2733 |
+
Math.random() * 10,
|
2734 |
+
Math.random() * 10,
|
2735 |
+
Math.random() * 10
|
2736 |
+
);
|
2737 |
+
debrisPiece.life = 2.0;
|
2738 |
+
|
2739 |
+
this.scene.add(debrisPiece);
|
2740 |
+
debris.push(debrisPiece);
|
2741 |
+
}
|
2742 |
+
|
2743 |
+
// μ°κΈ° ν¨κ³Ό
|
2744 |
+
const smokeCount = 10;
|
2745 |
+
const smoke = [];
|
2746 |
+
|
2747 |
+
for (let i = 0; i < smokeCount; i++) {
|
2748 |
+
const smokeGeometry = new THREE.SphereGeometry(10 + Math.random() * 20, 8, 8);
|
2749 |
+
const smokeMaterial = new THREE.MeshBasicMaterial({
|
2750 |
+
color: 0x222222,
|
2751 |
+
transparent: true,
|
2752 |
+
opacity: 0.8
|
2753 |
+
});
|
2754 |
+
|
2755 |
+
const smokePuff = new THREE.Mesh(smokeGeometry, smokeMaterial);
|
2756 |
+
smokePuff.position.copy(position);
|
2757 |
+
smokePuff.position.add(new THREE.Vector3(
|
2758 |
+
(Math.random() - 0.5) * 20,
|
2759 |
+
(Math.random() - 0.5) * 20,
|
2760 |
+
(Math.random() - 0.5) * 20
|
2761 |
+
));
|
2762 |
+
|
2763 |
+
smokePuff.velocity = new THREE.Vector3(
|
2764 |
+
(Math.random() - 0.5) * 50,
|
2765 |
+
Math.random() * 50 + 20,
|
2766 |
+
(Math.random() - 0.5) * 50
|
2767 |
+
);
|
2768 |
+
smokePuff.life = 3.0;
|
2769 |
+
|
2770 |
+
this.scene.add(smokePuff);
|
2771 |
+
smoke.push(smokePuff);
|
2772 |
+
}
|
2773 |
+
|
2774 |
+
// μ λλ©μ΄μ
|
2775 |
+
const animateExplosion = () => {
|
2776 |
+
let allDead = true;
|
2777 |
+
|
2778 |
+
// λ©μΈ νλ° μ λλ©μ΄μ
|
2779 |
+
if (explosion.material.opacity > 0) {
|
2780 |
+
explosion.material.opacity -= 0.02;
|
2781 |
+
explosion.scale.multiplyScalar(1.08);
|
2782 |
allDead = false;
|
2783 |
+
} else if (explosion.parent) {
|
2784 |
+
this.scene.remove(explosion);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2785 |
}
|
2786 |
+
|
2787 |
+
// ννΈ μ λλ©μ΄μ
|
2788 |
+
debris.forEach(piece => {
|
2789 |
+
if (piece.life > 0) {
|
2790 |
+
allDead = false;
|
2791 |
+
piece.life -= 0.02;
|
2792 |
+
|
2793 |
+
// μμΉ μ
λ°μ΄νΈ
|
2794 |
+
piece.position.add(piece.velocity.clone().multiplyScalar(0.02));
|
2795 |
+
|
2796 |
+
// μ€λ ₯
|
2797 |
+
piece.velocity.y -= 3;
|
2798 |
+
|
2799 |
+
// νμ
|
2800 |
+
piece.rotation.x += piece.rotationSpeed.x * 0.02;
|
2801 |
+
piece.rotation.y += piece.rotationSpeed.y * 0.02;
|
2802 |
+
piece.rotation.z += piece.rotationSpeed.z * 0.02;
|
2803 |
+
|
2804 |
+
// νμ΄λ μμ
|
2805 |
+
piece.material.opacity = piece.life / 2;
|
2806 |
+
} else if (piece.parent) {
|
2807 |
+
this.scene.remove(piece);
|
2808 |
+
}
|
2809 |
+
});
|
2810 |
+
|
2811 |
+
// μ°κΈ° μ λλ©μ΄μ
|
2812 |
+
smoke.forEach(puff => {
|
2813 |
+
if (puff.life > 0) {
|
2814 |
+
allDead = false;
|
2815 |
+
puff.life -= 0.02;
|
2816 |
+
|
2817 |
+
// μμΉ μ
λ°μ΄νΈ
|
2818 |
+
puff.position.add(puff.velocity.clone().multiplyScalar(0.02));
|
2819 |
+
|
2820 |
+
// μμΉ κ°μ
|
2821 |
+
puff.velocity.y *= 0.98;
|
2822 |
+
puff.velocity.x *= 0.98;
|
2823 |
+
puff.velocity.z *= 0.98;
|
2824 |
+
|
2825 |
+
// νμ°
|
2826 |
+
puff.scale.multiplyScalar(1.02);
|
2827 |
+
|
2828 |
+
// νμ΄λ μμ
|
2829 |
+
puff.material.opacity = (puff.life / 3) * 0.8;
|
2830 |
+
} else if (puff.parent) {
|
2831 |
+
this.scene.remove(puff);
|
2832 |
+
}
|
2833 |
+
});
|
2834 |
+
|
2835 |
+
if (!allDead) {
|
2836 |
+
requestAnimationFrame(animateExplosion);
|
2837 |
+
}
|
2838 |
+
};
|
2839 |
|
2840 |
+
animateExplosion();
|
2841 |
+
}
|
|
|
|
|
|
|
|
|
|
|
2842 |
|
2843 |
showHitMarker(position) {
|
2844 |
// ννΈ λ§μ»€ div μμ±
|