修复 Knife 武器攻击动画位置错误
This commit is contained in:
@@ -151,12 +151,8 @@ namespace SepCore.Entity
|
|||||||
|
|
||||||
public virtual ImpactData GetImpactData()
|
public virtual ImpactData GetImpactData()
|
||||||
{
|
{
|
||||||
float baseCrit = GameEntry.Luban != null && GameEntry.Luban.IsReady
|
float baseCrit = GameEntry.Luban.Global.WeaponBaseCrit;
|
||||||
? GameEntry.Luban.Global.WeaponBaseCrit
|
float critMult = GameEntry.Luban.Global.CritMultiplier;
|
||||||
: 0.05f;
|
|
||||||
float critMult = GameEntry.Luban != null && GameEntry.Luban.IsReady
|
|
||||||
? GameEntry.Luban.Global.CritMultiplier
|
|
||||||
: 1.5f;
|
|
||||||
|
|
||||||
return new ImpactData(
|
return new ImpactData(
|
||||||
WeaponData.OwnerCamp,
|
WeaponData.OwnerCamp,
|
||||||
|
|||||||
@@ -39,15 +39,37 @@ namespace SepCore.Entity
|
|||||||
_isAttacking = true;
|
_isAttacking = true;
|
||||||
Transform parentTransform = CachedTransform.parent;
|
Transform parentTransform = CachedTransform.parent;
|
||||||
_attackParent = parentTransform;
|
_attackParent = parentTransform;
|
||||||
_attackCenter = _target != null ? _target.CachedTransform.position : CachedTransform.position;
|
|
||||||
|
Vector3 startPos = CachedTransform.position;
|
||||||
|
Vector3 targetPos;
|
||||||
|
|
||||||
|
if (_target != null && _target.Available)
|
||||||
|
{
|
||||||
|
targetPos = _target.CachedTransform.position;
|
||||||
|
targetPos.y = startPos.y;
|
||||||
|
|
||||||
|
Vector3 delta = targetPos - startPos;
|
||||||
|
float maxRange = CurrentAttackRange;
|
||||||
|
if (delta.sqrMagnitude > maxRange * maxRange)
|
||||||
|
{
|
||||||
|
targetPos = startPos + delta.normalized * maxRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetPos = startPos + CachedTransform.forward * CurrentAttackRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
_attackCenter = _target != null && _target.Available ? _target.CachedTransform.position : targetPos;
|
||||||
CachedTransform.SetParent(null);
|
CachedTransform.SetParent(null);
|
||||||
|
|
||||||
Vector3 targetPos = CachedTransform.position + CachedTransform.forward * CurrentAttackRange;
|
|
||||||
_attackSequence = DOTween.Sequence();
|
_attackSequence = DOTween.Sequence();
|
||||||
_attackSequence.Append(CachedTransform.DOMove(targetPos, _attackDuration).SetEase(Ease.OutQuad));
|
_attackSequence.Append(CachedTransform.DOMove(targetPos, _attackDuration).SetEase(Ease.OutQuad));
|
||||||
_attackSequence.AppendCallback(() =>
|
_attackSequence.AppendCallback(() =>
|
||||||
{
|
{
|
||||||
_attackEffect.Play(this, _attackCenter, null, HitRadius);
|
Vector3 hitPoint = _target != null && _target.Available ? _target.CachedTransform.position : targetPos;
|
||||||
|
_attackCenter = hitPoint;
|
||||||
|
_attackEffect.Play(this, _attackCenter, _target, HitRadius);
|
||||||
ApplyGroundAreaDamage();
|
ApplyGroundAreaDamage();
|
||||||
if (_attackParent != null)
|
if (_attackParent != null)
|
||||||
{
|
{
|
||||||
@@ -74,8 +96,6 @@ namespace SepCore.Entity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_hitResults == null || _hitResults.Length == 0) return;
|
|
||||||
|
|
||||||
int hitCount = Physics.OverlapSphereNonAlloc(_attackCenter, radius, _hitResults, _hitMask,
|
int hitCount = Physics.OverlapSphereNonAlloc(_attackCenter, radius, _hitResults, _hitMask,
|
||||||
QueryTriggerInteraction.Collide);
|
QueryTriggerInteraction.Collide);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user