feat: 플레이어 다운 및 넉백 피격 반응 추가

- HitReactionController로 다운과 넉백 전용 로직을 분리
- 다운 시작, 루프, 회복 애니메이션과 DownEffect를 연결
- 행동 상태와 스킬 취소가 피격 반응과 연동되도록 정리
- 자동 검증 러너에 다운 및 넉백 검증을 추가
This commit is contained in:
2026-03-19 23:35:51 +09:00
parent a65ba77931
commit 9791b11d13
29 changed files with 7108 additions and 55 deletions

View File

@@ -0,0 +1,42 @@
using UnityEngine;
using Colosseum.Player;
namespace Colosseum.Skills.Effects
{
/// <summary>
/// 대상에게 다운 상태를 적용하는 스킬 효과입니다.
/// </summary>
[CreateAssetMenu(fileName = "DownEffect", menuName = "Colosseum/Skills/Effects/Down")]
public class DownEffect : SkillEffect
{
[Header("Settings")]
[Tooltip("다운 지속 시간")]
[Min(0f)] [SerializeField] private float duration = 1f;
/// <summary>
/// 다운 지속 시간
/// </summary>
public float Duration => duration;
/// <summary>
/// 다운 효과를 적용합니다.
/// </summary>
protected override void ApplyEffect(GameObject source, GameObject target)
{
if (target == null)
{
Debug.LogWarning("[DownEffect] Target is null.");
return;
}
if (!target.TryGetComponent(out HitReactionController hitReactionController))
{
Debug.LogWarning($"[DownEffect] HitReactionController not found on target: {target.name}");
return;
}
hitReactionController.ApplyDown(duration);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 41c96b54a96cdb84c9bda774775b0a1a

View File

@@ -1,5 +1,7 @@
using UnityEngine;
using Colosseum.Player;
namespace Colosseum.Skills.Effects
{
/// <summary>
@@ -11,6 +13,7 @@ namespace Colosseum.Skills.Effects
[Header("Knockback Settings")]
[Min(0f)] [SerializeField] private float force = 5f;
[SerializeField] private float upwardForce = 2f;
[Min(0.05f)] [SerializeField] private float duration = 0.2f;
protected override void ApplyEffect(GameObject caster, GameObject target)
{
@@ -18,13 +21,23 @@ namespace Colosseum.Skills.Effects
Vector3 direction = target.transform.position - caster.transform.position;
direction.y = 0f;
direction.Normalize();
if (direction.sqrMagnitude <= 0.0001f)
direction = caster.transform.forward;
else
direction.Normalize();
Vector3 knockback = direction * force + Vector3.up * upwardForce;
Vector3 knockbackVelocity = direction * force + Vector3.up * upwardForce;
// TODO: 실제 물리 시스템 연동
// if (target.TryGetComponent<Rigidbody>(out var rb))
// rb.AddForce(knockback, ForceMode.Impulse);
if (target.TryGetComponent<HitReactionController>(out var hitReactionController))
{
hitReactionController.ApplyKnockback(knockbackVelocity, duration);
return;
}
if (target.TryGetComponent<PlayerMovement>(out var playerMovement))
{
playerMovement.ApplyForcedMovement(knockbackVelocity, duration);
}
}
}
}

View File

@@ -4,6 +4,19 @@ using Unity.Netcode;
namespace Colosseum.Skills
{
/// <summary>
/// 스킬 강제 취소 이유
/// </summary>
public enum SkillCancelReason
{
None,
Manual,
Death,
Stun,
HitReaction,
Respawn,
}
/// <summary>
/// 스킬 실행을 관리하는 컴포넌트.
/// 애니메이션 이벤트 기반으로 효과가 발동됩니다.
@@ -31,6 +44,12 @@ namespace Colosseum.Skills
[Tooltip("범위 표시 지속 시간")]
[Min(0.1f)] [SerializeField] private float debugDrawDuration = 1f;
[Header("디버그")]
[Tooltip("마지막으로 강제 취소된 스킬 이름")]
[SerializeField] private string lastCancelledSkillName = string.Empty;
[Tooltip("마지막 강제 취소 이유")]
[SerializeField] private SkillCancelReason lastCancelReason = SkillCancelReason.None;
// 현재 실행 중인 스킬
private SkillData currentSkill;
private bool skillEndRequested; // OnSkillEnd 이벤트 호출 여부
@@ -47,9 +66,14 @@ namespace Colosseum.Skills
public bool IgnoreRootMotionY => currentSkill != null && currentSkill.IgnoreRootMotionY;
public SkillData CurrentSkill => currentSkill;
public Animator Animator => animator;
public SkillCancelReason LastCancelReason => lastCancelReason;
public string LastCancelledSkillName => lastCancelledSkillName;
private void Awake()
{
lastCancelledSkillName = string.Empty;
lastCancelReason = SkillCancelReason.None;
if (animator == null)
{
animator = GetComponentInChildren<Animator>();
@@ -135,6 +159,7 @@ namespace Colosseum.Skills
currentSkill = skill;
skillEndRequested = false;
waitingForEndAnimation = false;
lastCancelReason = SkillCancelReason.None;
if (debugMode) Debug.Log($"[Skill] Cast: {skill.SkillName}");
@@ -339,16 +364,24 @@ namespace Colosseum.Skills
if (debugMode) Debug.Log($"[Skill] End requested: {currentSkill.SkillName} (will complete after animation)");
}
public void CancelSkill()
/// <summary>
/// 현재 스킬을 강제 취소합니다.
/// </summary>
public bool CancelSkill(SkillCancelReason reason = SkillCancelReason.Manual)
{
if (currentSkill != null)
{
if (debugMode) Debug.Log($"Skill cancelled: {currentSkill.SkillName}");
RestoreBaseController();
currentSkill = null;
skillEndRequested = false;
waitingForEndAnimation = false;
}
if (currentSkill == null)
return false;
lastCancelledSkillName = currentSkill.SkillName;
lastCancelReason = reason;
Debug.Log($"[Skill] Cancelled: {currentSkill.SkillName} / reason={reason}");
RestoreBaseController();
currentSkill = null;
skillEndRequested = false;
waitingForEndAnimation = false;
return true;
}
public bool IsOnCooldown(SkillData skill)