Files
zeling_v2/Assets/_Game/Scripts/Enemies/EnemyPoiseComponent.cs
T
joywayerandClaude Opus 5 cf0ac60fad refactor(enemy): 清全库行为树残留,删无人使用的 Boss 技能事件频道
Task 21 Step 2 全库扫描后的收尾:

注释与 Tooltip 里的旧决策层措辞逐处改为只描述功能——
EnemyControlledState / RangedEnemy / FlyingEnemy / SensorSlotNames /
EnemyPoiseComponent / EnemyAnimationConfigSO / EnemyAiBrain。

EnemyQuotaManager 的序列化字段 _maxActiveBehaviorTrees 改名 _maxActiveBrains
(它裁剪的实际是 EnemyAiBrain),带 FormerlySerializedAs。复核确认目前
无任何场景 / 预制体挂载该组件,故无值可丢;属未雨绸缪。

BossSkillEventChannelSO + BossEvents.BossSkillEvent + EVT_BossSkill.asset 删除:
唯一发送方 BossSkillExecutor 已随旧轨删除,复核确认全项目零发送方、零订阅方,
资产 guid 在场景 / 预制体 / Addressables 分组中均无引用。

自检:编译 0 error;EditMode 260/260 通过;
SO 校验 0 error 0 warning;层矩阵 25/25 正确。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 17:14:09 +08:00

41 lines
1.8 KiB
C#

using UnityEngine;
using BaseGames.Combat;
namespace BaseGames.Enemies
{
/// <summary>
/// 敌人霸体组件(架构 06_CombatModule §13)。
/// Awake 时自动注入到同节点 HurtBox(无需手动 Inspector 赋值)。
/// EnemyBase、能力模块或动画事件可调用 SetPoiseLevel / ResetPoiseLevel 切换超甲状态。
/// </summary>
[RequireComponent(typeof(EnemyBase))]
public class EnemyPoiseComponent : MonoBehaviour, IPoiseSource
{
[SerializeField] private PoiseLevel _defaultPoiseLevel = PoiseLevel.None;
private PoiseLevel _currentPoiseLevel;
private void Awake()
{
_currentPoiseLevel = _defaultPoiseLevel;
// 自动注入到所有子节点 HurtBox(支持多形状受击区)
foreach (var hurtBox in GetComponentsInChildren<HurtBox>(true))
hurtBox.SetPoiseSource(this);
}
// ── IPoiseSource ──────────────────────────────────────────────────────
/// <summary>返回当前帧的霸体等级(供 HurtBox.ReceiveDamage 步骤 3 比较)。</summary>
public PoiseLevel GetCurrentPoiseLevel() => _currentPoiseLevel;
// ── 外部 API ──────────────────────────────────────────────────────────
/// <summary>进入/退出超甲时由 EnemyBase、能力模块或动画事件调用。</summary>
public void SetPoiseLevel(PoiseLevel level) => _currentPoiseLevel = level;
/// <summary>恢复到默认霸体等级(超甲结束时调用)。</summary>
public void ResetPoiseLevel() => _currentPoiseLevel = _defaultPoiseLevel;
}
}