2026-05-29 로딩기능

This commit is contained in:
2026-05-29 12:25:32 +09:00
parent 7ad70e7997
commit 3190f10d7d
19 changed files with 167 additions and 29 deletions

View File

@@ -28,6 +28,7 @@ public class Enemy : MonoBehaviour, IDamageable
[SerializeField] private Color _hitFlashColor = Color.red; // 깜빡 색상
[SerializeField] private float _hitStunDuration = 0.25f; // ActionData 값이 없을 때 쓰는 기본 경직 시간
[SerializeField] private string _hitAnimationState = "HitDamage"; // 공격 데이터에 피격 애니가 없을 때 재생할 기본 State
[SerializeField] private bool _hasSuperArmor = false; // true면 경직/넉백 무시 (데미지·플래시는 받음). 보스 등 패턴 유지용
// ─── 넉백 / 벽 반사 파라미터 ─────────────────────────────────────────
[Header("Hit Bounce")]
@@ -92,7 +93,7 @@ public class Enemy : MonoBehaviour, IDamageable
public bool IsGrabbable => _isGrabbable;
public bool IsInvulnerable => _isInvulnerable;
public bool IsInHitReaction => _hitStunTimer > 0f || _hitReactionTimer > 0f || _isHitPositionCorrecting || _flashTimer > 0f;
public bool CanUseAI => !IsDead && !_isGrabbed && !IsInHitReaction;
public bool CanUseAI => !IsDead && !_isGrabbed && (_hasSuperArmor || !IsInHitReaction);
public event Action OnDamaged;
@@ -287,29 +288,34 @@ public void TakeDamage(int amount, Vector2 hitVelocity = default, string hitReac
// 무적이면 데미지/플래시/넉백 전부 무시.
if (_isInvulnerable) return;
float appliedHitStunDuration = hitStunDuration >= 0f ? hitStunDuration : _hitStunDuration;
_hitStunTimer = Mathf.Max(_hitStunTimer, appliedHitStunDuration);
OnDamaged?.Invoke();
_isGrabbed = false;
StartHitFlash();
PlayHitAnimation(hitReactionAnimationState);
StartHitFlash(); // 피격 플래시는 슈퍼아머여도 유지 (타격감 피드백)
// 새 피격이 반응 속도를 전부 결정하므로, 이전 튕김/넉백 속도는 먼저 제거한다.
if (_rb != null)
// 슈퍼아머: 경직 타이머·피격 모션·넉백·위치 보정을 전부 생략 → 패턴이 안 끊긴다.
if (!_hasSuperArmor)
{
_hitReactionTimer = 0f;
_rb.linearVelocity = Vector2.zero;
_lastVelocity = Vector2.zero;
float appliedHitStunDuration = hitStunDuration >= 0f ? hitStunDuration : _hitStunDuration;
_hitStunTimer = Mathf.Max(_hitStunTimer, appliedHitStunDuration);
PlayHitAnimation(hitReactionAnimationState);
BeginHitTargetPositionCorrection(hitTargetPosition, correctHitTargetY, hitPositionSolidMask, hitPositionCorrectionDuration);
Vector2 nextVelocity = GetHitReactionVelocity(hitVelocity);
if (nextVelocity != Vector2.zero)
// 새 피격이 반응 속도를 전부 결정하므로, 이전 튕김/넉백 속도는 먼저 제거한다.
if (_rb != null)
{
_rb.linearVelocity = nextVelocity;
_lastVelocity = nextVelocity;
_hitReactionTimer = _hitReactionDuration;
_hitReactionTimer = 0f;
_rb.linearVelocity = Vector2.zero;
_lastVelocity = Vector2.zero;
BeginHitTargetPositionCorrection(hitTargetPosition, correctHitTargetY, hitPositionSolidMask, hitPositionCorrectionDuration);
Vector2 nextVelocity = GetHitReactionVelocity(hitVelocity);
if (nextVelocity != Vector2.zero)
{
_rb.linearVelocity = nextVelocity;
_lastVelocity = nextVelocity;
_hitReactionTimer = _hitReactionDuration;
}
}
}