This commit is contained in:
2026-06-05 22:54:37 +07:00
parent 6f7c4a22b3
commit c14d3c3a95
6 changed files with 80 additions and 1791 deletions

View File

@@ -28,29 +28,27 @@ public class LaserProjectile : MonoBehaviour
// Debug: Log tên và tag của bất cứ thứ gì đạn chạm vào
Debug.Log($"Laser collided with: {other.name} | Tag: {other.tag} | Layer: {LayerMask.LayerToName(other.gameObject.layer)}");
// Kiểm tra nếu trúng Player
if (other.CompareTag("Player") || other.GetComponentInParent<vIHealthController>() != null)
// 1. Kiểm tra nếu trúng Player hoặc đối tượng có Health
var healthController = other.GetComponentInParent<vIHealthController>();
if (other.CompareTag("Player") || healthController != null)
{
var healthController = other.GetComponentInParent<vIHealthController>();
if (healthController != null)
{
Debug.Log($"<color=red>HIT PLAYER!</color> Found health controller on {healthController.gameObject.name}. Applying {damageAmount} damage.");
Debug.Log($"<color=red>HIT PLAYER!</color> Applying {damageAmount} damage.");
var damage = new vDamage(damageAmount);
damage.sender = transform;
damage.hitPosition = transform.position;
healthController.TakeDamage(damage);
}
// Luôn phá hủy đạn khi trúng Player
Impact();
return;
}
// Phá hủy đạn nếu trúng tường, sàn nhà (mọi thứ không phải trigger khác)
// 2. Phá hủy đạn nếu trúng Ground, Tường, hoặc bất kỳ vật thể đặc nào (không phải Trigger)
if (!other.isTrigger)
{
Debug.Log("Laser hit an obstacle (Wall/Floor).");
Debug.Log($"Laser hit solid object: {other.name} (Ground/Obstacle). Destroying.");
Impact();
}
}

View File

@@ -13,19 +13,24 @@ Material:
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _COLOROVERLAY_ON
- _DISTORTION_ON
- _FADING_ON
- _FLIPBOOKBLENDING_ON
- _SOFTPARTICLES_ON
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords:
- EFFECT_BUMP
- _ALPHABLEND_ON
- _FLIPBOOKBLENDING_OFF
- _REQUIRE_UV2
m_LightmapFlags: 0
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
@@ -88,8 +93,8 @@ Material:
- _DistortionEnabled: 1
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _DstBlend: 10
- _DstBlendAlpha: 10
- _EmissionEnabled: 1
- _FlipbookBlending: 1
- _FlipbookMode: 1
@@ -108,11 +113,11 @@ Material:
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _UVSec: 0
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
@@ -121,7 +126,7 @@ Material:
- _ColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _EmisColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0.31132078, g: 0.31132078, b: 0.31132078, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1