refactor(enemy): 删预警旧路径,预警统一走动画
telegraphVfxKey / telegraphDuration / TelegraphRoutine 删除。 预警的正确载体是 clip 本身——姿态在动画里,音效与特效在动画事件上 (PlaySFX / TriggerFeedback 已于阶段一补接)。旧路径会在动画之前 插一段无动画的静止等待,是同一件事的第二条平行路。 AbilityRunState.Telegraph 枚举值保留:BlinkStrikeAbility 现身闪光段 仍在自己协程里显式置位(计划原文假设它零消费者,实测不成立), 只删了基类的默认预警协程。顺带清掉该文件里遗留的行为树插件措辞。 18 个 ABL_ 资产经 AssetDatabase.ForceReserializeAssets 重写, 去掉已删字段的死键;顺带补齐了这些旧资产缺失的当前字段默认值 (designNote / category / weight / rangeRadius / rangeOffset / maxDashDuration), 无任何已有取值被改动。SOValidationRunner:0 错误 0 警告。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,12 @@ namespace BaseGames.Enemies.Abilities
|
||||
{
|
||||
/// <summary>
|
||||
/// 能力执行的阶段枚举(架构 07_EnemyModule §8)。
|
||||
/// 用于 BD/Animator/UI 查询能力当前在哪个阶段(telegraph/出招/恢复)。
|
||||
/// 用于 AI 决策层 / 动画 / UI 查询能力当前在哪个阶段(预警 / 出招 / 恢复)。
|
||||
/// </summary>
|
||||
public enum AbilityRunState
|
||||
{
|
||||
Idle,
|
||||
/// <summary>预警:由能力自身在协程里显式置位(如 BlinkStrikeAbility 的现身闪光)。</summary>
|
||||
Telegraph,
|
||||
Windup,
|
||||
Active,
|
||||
@@ -14,7 +15,7 @@ namespace BaseGames.Enemies.Abilities
|
||||
Interrupted
|
||||
}
|
||||
|
||||
/// <summary>能力中断原因。供 BD 判断是否需要重新调度。</summary>
|
||||
/// <summary>能力中断原因。供 AI 决策层判断是否需要重新调度。</summary>
|
||||
public enum InterruptReason
|
||||
{
|
||||
ExternalRequest,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Animancer;
|
||||
using BaseGames.Core;
|
||||
using BaseGames.Core.Pool;
|
||||
|
||||
namespace BaseGames.Enemies.Abilities
|
||||
{
|
||||
@@ -114,13 +112,9 @@ namespace BaseGames.Enemies.Abilities
|
||||
private IEnumerator RunInternal()
|
||||
{
|
||||
_isRunning = true;
|
||||
Phase = AbilityRunState.Telegraph;
|
||||
Phase = AbilityRunState.Windup;
|
||||
try
|
||||
{
|
||||
if (_config != null && _config.telegraphDuration > 0f)
|
||||
yield return TelegraphRoutine();
|
||||
|
||||
Phase = AbilityRunState.Windup;
|
||||
yield return ExecuteCoroutine();
|
||||
Phase = AbilityRunState.Recovery;
|
||||
}
|
||||
@@ -137,17 +131,6 @@ namespace BaseGames.Enemies.Abilities
|
||||
/// <summary>子类实现:能力主体。可分多段、含 HitBox 激活/弹幕生成/物理推进等。</summary>
|
||||
protected abstract IEnumerator ExecuteCoroutine();
|
||||
|
||||
/// <summary>预警阶段(默认生成 VFX 后等待 telegraphDuration)。子类可重写。</summary>
|
||||
protected virtual IEnumerator TelegraphRoutine()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_config.telegraphVfxKey))
|
||||
{
|
||||
var pool = ServiceLocator.GetOrDefault<IObjectPoolService>();
|
||||
pool?.Spawn(_config.telegraphVfxKey, _transform.position, Quaternion.identity);
|
||||
}
|
||||
yield return EnemyAbilityWaits.Get(_config.telegraphDuration);
|
||||
}
|
||||
|
||||
/// <summary>能力结束钩子(被中断或正常结束都会调用)。</summary>
|
||||
protected virtual void OnAbilityEnded() { }
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace BaseGames.Enemies.Abilities
|
||||
{
|
||||
/// <summary>
|
||||
/// 能力配置包(架构 07_EnemyModule §8.2)。
|
||||
/// 一个能力 = 一组攻击段 + 公共参数(冷却/预警/中断规则)。
|
||||
/// 一个能力 = 一组攻击段 + 公共参数(冷却/中断规则)。
|
||||
/// 预警不在此配置:预警的载体是动画 clip 本身(姿态在动画里,音效与特效挂动画事件)。
|
||||
/// 由对应 EnemyAbilityBase 子类组件读取并执行。
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "BaseGames/Enemies/Enemy Ability", fileName = "ABL_")]
|
||||
@@ -27,11 +28,6 @@ namespace BaseGames.Enemies.Abilities
|
||||
[Header("冷却(秒,从能力执行结束开始计)")]
|
||||
[Min(0f)] public float cooldown = 1.5f;
|
||||
|
||||
[Header("预警(Telegraph)")]
|
||||
[Tooltip("预警 VFX key(IObjectPoolService.Spawn 的池 key),为空则跳过")]
|
||||
public string telegraphVfxKey = "";
|
||||
[Min(0f)] public float telegraphDuration = 0f;
|
||||
|
||||
[Header("中断规则")]
|
||||
[Tooltip("受击时是否打断能力(false=能力具霸体)")]
|
||||
public bool interruptOnHurt = true;
|
||||
|
||||
Reference in New Issue
Block a user