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:
@@ -4,10 +4,15 @@ namespace BaseGames.Enemies.Perception
|
||||
{
|
||||
/// <summary>
|
||||
/// 敌人感知系统接口。
|
||||
/// EnemyBase 通过此接口与感知实现解耦,支持运行时替换(SensorToolkit / 自定义实现)。
|
||||
/// EnemyBase 通过此接口与感知实现解耦,支持运行时替换。
|
||||
/// 当前实现为 <see cref="PhysicsPerceptionSystem"/>(纯物理射线 / 圆形范围检测)。
|
||||
/// 若未来替换底层传感器实现,只需重新实现此接口,上层代码无需改动。
|
||||
/// </summary>
|
||||
public interface IPerceptionSystem
|
||||
{
|
||||
/// <summary>指定槽位是否已配置(用于运行前的能力检测,避免无效查询)。</summary>
|
||||
bool HasSlot(string slotName);
|
||||
|
||||
/// <summary>指定槽位是否检测到任意目标。</summary>
|
||||
bool HasAnyDetection(string slotName);
|
||||
|
||||
@@ -17,6 +22,20 @@ namespace BaseGames.Enemies.Perception
|
||||
/// <summary>返回指定槽位第一个检测到的对象,无检测则返回 null。</summary>
|
||||
GameObject GetFirstDetection(string slotName);
|
||||
|
||||
/// <summary>
|
||||
/// 返回指定槽位感知区域的半径(圆形区域)。
|
||||
/// 槽位不存在、非圆形区域或实现不支持时返回 -1。
|
||||
/// 主要供编辑器 Gizmos 绘制使用。
|
||||
/// </summary>
|
||||
float GetSensorRadius(string slotName);
|
||||
|
||||
/// <summary>
|
||||
/// 返回指定槽位检测原点相对于感知组件 transform 的偏移(X 分量已根据朝向翻转)。
|
||||
/// 槽位不存在时返回 <see cref="Vector2.zero"/>。
|
||||
/// 供 EnemyBase.OnDrawGizmos 定位各感知圆心使用,避免所有圆重叠在 transform.position。
|
||||
/// </summary>
|
||||
Vector2 GetSensorOffset(string slotName);
|
||||
|
||||
/// <summary>暂停或恢复感知系统(LOD / 超出活跃范围时调用)。</summary>
|
||||
void SetSuspended(bool suspended);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user