- Updated PhysicsPerceptionSystem to support seven detection modes: RangeCircle, BatchLOS, FanCast, BoxCast, Sight, RayCast, and TriggerZone. - Improved documentation for each detection mode, including performance optimization strategies. - Introduced PerceptionTriggerProxy for event-driven detection in TriggerZone slots. - Added SightBatchSystem to manage Sight slots efficiently, reducing CPU spikes during high enemy counts. - Updated SensorSlotNames to reflect new detection modes and their purposes. - Enhanced internal logic for detecting targets and managing detection events.
29 lines
972 B
C#
29 lines
972 B
C#
#if GRAPH_DESIGNER
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks;
|
||
using Opsive.BehaviorDesigner.Runtime.Tasks.Conditionals;
|
||
using BaseGames.Enemies;
|
||
|
||
namespace BaseGames.Enemies.AI
|
||
{
|
||
/// <summary>
|
||
/// BD Conditional:玩家是否可见(LOS 检测)。
|
||
/// 读取 EnemyBase.IsPlayerVisible(),结果来自 PhysicsPerceptionSystem(LOS / Sight 槽位)。
|
||
/// </summary>
|
||
[TaskName("Is Player Visible?")]
|
||
[TaskCategory("BaseGames/Enemy/Perception")]
|
||
[TaskDescription("检查是否有视线到达玩家(通过 EnemyBase.HasLineOfSight)")]
|
||
public class BD_IsPlayerVisible : Conditional
|
||
{
|
||
private EnemyBase _enemy;
|
||
|
||
public override void OnAwake() => _enemy = GetComponent<EnemyBase>();
|
||
|
||
public override TaskStatus OnUpdate()
|
||
{
|
||
if (_enemy == null) return TaskStatus.Failure;
|
||
return _enemy.IsPlayerVisible() ? TaskStatus.Success : TaskStatus.Failure;
|
||
}
|
||
}
|
||
}
|
||
#endif
|