feat(feedback): 命中/受击反馈支持固定位置与击中位置两种生成模式
DamageInfo 新增运行时字段 HitPoint:HitBox 结算时写入精确接触点 (ClosestPoint),HurtBox.ReceiveDamage 以解析后命中点兜底盖戳, 陷阱/环境等直调路径同样可用。IFeedbackPlayer.PlayHit/PlayTakeHit 增加命中点参数,全链路(武器实例→PlayerCombat→HurtState→ EnemyFeedback)透传。各 Feedback 组件命中/受击槽位新增 FeedbackPositionMode(Fixed=反馈链编排的固定位置 / HitPoint=传入命中点,启用位置选项的模块在该点生成),由编排 反馈链的开发者在 Inspector 按表现选择;武器命中默认 HitPoint (火花贴点),角色级默认 Fixed(震屏/振动与位置无关)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -268,15 +268,18 @@ namespace BaseGames.Combat
|
||||
_ownerProjectile);
|
||||
info.HitActivationId = _currentActivationId;
|
||||
|
||||
// hitPoint:优先使用触发命中的碰撞体中心在目标表面的最近点;
|
||||
// 无 sourceCollider(直属碰撞体)时回退到 HitBox 节点坐标。
|
||||
// 写入 info.HitPoint 供下游"击中位置"模式的反馈在该点生成。
|
||||
Vector2 hitOrigin = sourceCollider != null
|
||||
? (Vector2)sourceCollider.bounds.center
|
||||
: (Vector2)transform.position;
|
||||
Vector3 hitPoint = other.ClosestPoint(hitOrigin);
|
||||
info.HitPoint = hitPoint;
|
||||
|
||||
// ② 命中 HurtBox
|
||||
if (other.TryGetComponent<HurtBox>(out var hurtBox))
|
||||
{
|
||||
// hitPoint:优先使用触发命中的碰撞体中心在 HurtBox 表面的最近点;
|
||||
// 无 sourceCollider(直属碰撞体)时回退到 HitBox 节点坐标。
|
||||
Vector2 hitOrigin = sourceCollider != null
|
||||
? (Vector2)sourceCollider.bounds.center
|
||||
: (Vector2)transform.position;
|
||||
Vector3 hitPoint = other.ClosestPoint(hitOrigin);
|
||||
hurtBox.ReceiveDamage(info, hitPoint);
|
||||
OnHitConfirmed?.Invoke(info);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user