2026-05-18 공격에 의한 이동량 초기화

This commit is contained in:
2026-05-18 11:54:10 +09:00
parent ea3a4fbbcc
commit adcd69c537
3 changed files with 24 additions and 21 deletions

View File

@@ -14,7 +14,7 @@ public class AttackHitbox : MonoBehaviour
private void Awake()
{
_collider = GetComponent<CircleCollider2D>();
// The player body does not collide with enemies; this trigger is the only attack contact.
// 플레이어 몸체는 적과 물리 충돌하지 않으므로, 공격 판정은 이 트리거만 사용한다.
_collider.isTrigger = true;
_collider.enabled = false;
}
@@ -30,7 +30,7 @@ public void Activate(ActionData data, Vector2 localPosition, Vector2 hitVelocity
_alreadyHit.Clear();
_collider.enabled = true;
// Catch enemies already inside the hitbox on the same frame it opens.
// 판정이 켜진 순간 이미 범위 안에 있던 적도 같은 프레임에 잡아낸다.
ScanImmediateOverlap();
}
@@ -54,7 +54,7 @@ private void TryDamage(Collider2D other)
{
if ((_targetLayer.value & (1 << other.gameObject.layer)) == 0) return;
// Hurtboxes may live on child objects, while damage handling usually lives on the root.
// 피격 콜라이더는 자식에 있고, 데미지 처리는 루트에 있을 수 있다.
if (!other.TryGetComponent<IDamageable>(out var target))
target = other.GetComponentInParent<IDamageable>();
if (target == null) return;