feat: Add HurtBoxOwnerGuard to prevent multiple damage registrations from the same HitBox activation

- Implemented HurtBoxOwnerGuard to ensure that multiple HurtBoxes on the same character do not register damage multiple times during a single HitBox activation.
- Added custom editor for HitBox to facilitate the creation of shape colliders with HitBoxColliderProxy.
- Introduced PhysicsPerceptionSystem for enemy perception, supporting multiple detection modes including RangeCircle, BatchLOS, FanCast, and BoxCast.
- Created EnemyPatrolZone to define patrol and chase areas for enemies, allowing for shared zones among multiple enemies.
- Added BD_IsOutsideZone conditional task for Behavior Designer to check if an enemy or player is outside a defined patrol zone.
This commit is contained in:
2026-06-02 16:10:44 +08:00
parent bcd8b0e90b
commit 06048c966a
47 changed files with 1912 additions and 1195 deletions

View File

@@ -1,43 +1,33 @@
namespace BaseGames.Enemies.Perception
{
/// <summary>
/// <see cref="EnemySensorHub"/> 槽位名称常量。
/// <see cref="PhysicsPerceptionSystem"/> 槽位名称常量。
///
/// 统一定义字符串键,避免在 BD Task Inspector 和代码中散布魔法字符串。
/// Prefab 上 EnemySensorHub 组件的 slotName 字段必须与此处常量保持一致。
/// Prefab 上 <see cref="PhysicsPerceptionSystem"/> 组件的 slotName 字段必须与此处常量保持一致。
/// </summary>
public static class SensorSlotNames
{
/// <summary>
/// 警戒范围RangeSensor2D):玩家进入此圈触发 Alert 阶段。
/// 警戒范围RangeCircle):玩家进入此圈触发 Alert 阶段。
/// 通常半径大于攻击范围,小于视线检测范围。
/// </summary>
public const string Aggro = "aggro";
/// <summary>
/// 视线检测(LOSSensor2D):敌我之间无遮挡时持续为 true。
/// 视线检测(BatchLOS):敌我之间无遮挡时持续为 true。
/// 由 BatchLOSSystem 批量计算BD_IsPlayerVisible 读取结果。
/// </summary>
public const string LOS = "los";
/// <summary>
/// 近战攻击范围RangeSensor2D):玩家进入时触发近战攻击条件。
/// 近战攻击范围RangeCircle):玩家进入时触发近战攻击条件。
/// </summary>
public const string AttackMelee = "attack_melee";
/// <summary>
/// 远程攻击范围RangeSensor2D):玩家进入时触发远程攻击条件。
/// 远程攻击范围RangeCircle):玩家进入时触发远程攻击条件。
/// </summary>
public const string AttackRange = "attack_range";
/// <summary>
/// 前方墙体RaySensor2D水平方向检测用于巡逻转向。
/// </summary>
public const string WallAhead = "wall_ahead";
/// <summary>
/// 前方悬崖RaySensor2D斜向下检测地面是否存在用于巡逻转向。
/// </summary>
public const string Ledge = "ledge";
}
}