- TestBoss 관련 프리팹, 데이터, 애니메이션, BT 자산을 Drog 명칭으로 정리 - 드로그 전용 패턴 컨트롤러와 기본 패턴 루프를 추가 - 오른손치기2 기반 내려찍기와 다운 추가타 연계 진입점을 구현 - 점프, 스윙, 다운 추가타 관련 스킬 및 이펙트 데이터를 정리
52 lines
1.8 KiB
C#
52 lines
1.8 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;
|
|
|
|
HitReactionController hitReactionController = target.GetComponent<HitReactionController>();
|
|
if (hitReactionController == null)
|
|
hitReactionController = target.GetComponentInParent<HitReactionController>();
|
|
|
|
if (hitReactionController != null)
|
|
{
|
|
hitReactionController.ApplyKnockback(knockbackVelocity, duration);
|
|
return;
|
|
}
|
|
|
|
PlayerMovement playerMovement = target.GetComponent<PlayerMovement>();
|
|
if (playerMovement == null)
|
|
playerMovement = target.GetComponentInParent<PlayerMovement>();
|
|
|
|
if (playerMovement != null)
|
|
{
|
|
playerMovement.ApplyForcedMovement(knockbackVelocity, duration);
|
|
}
|
|
}
|
|
}
|
|
}
|