重构
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Architecture.Core;
|
||||
|
||||
namespace IndianOceanAssets.Engine2_5D
|
||||
{
|
||||
@@ -46,6 +47,9 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
[Tooltip("聆听范围:主角在此范围内按E摇铃时,敌人会朝铃铛位置移动")]
|
||||
[SerializeField] private float listenRange = 15f;
|
||||
|
||||
[Header("SO 事件通道(替代 static EchoSystem.OnEchoReleased 事件)")]
|
||||
[SerializeField] private Vector3Event echoReleasedEvent;
|
||||
|
||||
[Header("铃铛追击")]
|
||||
[Tooltip("到达铃铛位置后的容差距离")]
|
||||
[SerializeField] private float bellArriveDistance = 1f;
|
||||
@@ -105,6 +109,12 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
private HealthSystem _playerHealth; // 玩家血量引用
|
||||
private Camera _mainCam; // 主相机引用(用于Billboard)
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
if (echoReleasedEvent == null)
|
||||
Debug.LogWarning($"[EnemyAI] Echo Released Event 未接线({gameObject.name})。该敌人不会响应摇铃。", this);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (playerTarget == null)
|
||||
@@ -127,12 +137,12 @@ namespace IndianOceanAssets.Engine2_5D
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
EchoSystem.OnEchoReleased += OnBell;
|
||||
echoReleasedEvent?.Register(OnBell);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
EchoSystem.OnEchoReleased -= OnBell;
|
||||
echoReleasedEvent?.Unregister(OnBell);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
|
||||
Reference in New Issue
Block a user