Refactor code structure for improved readability and maintainability
This commit is contained in:
45
Assets/_Game/Scripts/Enemies/E004_ZhiMu.cs
Normal file
45
Assets/_Game/Scripts/Enemies/E004_ZhiMu.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using Animancer;
|
||||
using BaseGames.Combat;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>
|
||||
/// E004 蛭母(小Boss)。
|
||||
/// 特性:
|
||||
/// - 出场演出(AppearAbility)
|
||||
/// - 三技能(撕咬/头槌/酸液)+ 翻身(FacePlayerAbility)
|
||||
/// - 死亡两阶段:Death_Pre 无敌演出 → base.Die()
|
||||
/// </summary>
|
||||
public class E004_ZhiMu : EnemyBase
|
||||
{
|
||||
[Header("死亡演出")]
|
||||
[SerializeField] private ClipTransition _deathPreClip;
|
||||
[SerializeField] private HurtBox _hurtBox;
|
||||
[SerializeField] private float _deathPreDuration = 3f;
|
||||
|
||||
protected override void Die()
|
||||
{
|
||||
StartCoroutine(DeathSequence());
|
||||
}
|
||||
|
||||
private IEnumerator DeathSequence()
|
||||
{
|
||||
// 停止行为树防止覆盖演出动画
|
||||
StopBehaviorTree();
|
||||
StopMovement();
|
||||
|
||||
if (_hurtBox != null)
|
||||
_hurtBox.enabled = false;
|
||||
|
||||
if (_deathPreClip.Clip != null)
|
||||
{
|
||||
Animancer.Play(_deathPreClip);
|
||||
yield return new WaitForSeconds(_deathPreDuration);
|
||||
}
|
||||
|
||||
base.Die();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user