- HitReactionController로 다운과 넉백 전용 로직을 분리 - 다운 시작, 루프, 회복 애니메이션과 DownEffect를 연결 - 행동 상태와 스킬 취소가 피격 반응과 연동되도록 정리 - 자동 검증 러너에 다운 및 넉백 검증을 추가
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
using Colosseum.Player;
|
|
|
|
namespace Colosseum.Skills.Effects
|
|
{
|
|
/// <summary>
|
|
/// 넉백 효과
|
|
/// </summary>
|
|
[CreateAssetMenu(fileName = "KnockbackEffect", menuName = "Colosseum/Skills/Effects/Knockback")]
|
|
public class KnockbackEffect : SkillEffect
|
|
{
|
|
[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)
|
|
{
|
|
if (target == null || caster == null) return;
|
|
|
|
Vector3 direction = target.transform.position - caster.transform.position;
|
|
direction.y = 0f;
|
|
if (direction.sqrMagnitude <= 0.0001f)
|
|
direction = caster.transform.forward;
|
|
else
|
|
direction.Normalize();
|
|
|
|
Vector3 knockbackVelocity = direction * force + Vector3.up * upwardForce;
|
|
|
|
if (target.TryGetComponent<HitReactionController>(out var hitReactionController))
|
|
{
|
|
hitReactionController.ApplyKnockback(knockbackVelocity, duration);
|
|
return;
|
|
}
|
|
|
|
if (target.TryGetComponent<PlayerMovement>(out var playerMovement))
|
|
{
|
|
playerMovement.ApplyForcedMovement(knockbackVelocity, duration);
|
|
}
|
|
}
|
|
}
|
|
}
|