Refactor code structure for improved readability and maintainability
This commit is contained in:
34
Assets/_Game/Scripts/Enemies/E003_YouZhi.cs
Normal file
34
Assets/_Game/Scripts/Enemies/E003_YouZhi.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using Animancer;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>
|
||||
/// E003 幼蛭。HP=1,一击即死。
|
||||
/// 支持双路初始化:
|
||||
/// - 预置路径:场景战斗触发器调用 <see cref="ActivateFromCeiling"/>
|
||||
/// - 对象池路径:E005 死亡时通过 <see cref="OnSpawn"/> 自动触发
|
||||
/// 能力脚本 <c>AnimatedCeilingDropAbility</c> 负责 Fall 动画 + 物理下落 + SetAiPhase(Patrol)。
|
||||
/// </summary>
|
||||
public class E003_YouZhi : EnemyBase
|
||||
{
|
||||
[Tooltip("对象池生成时是否立即执行下落能力(E005 触发生成路径)")]
|
||||
[SerializeField] private bool _activateOnSpawn = true;
|
||||
|
||||
public override void OnSpawn()
|
||||
{
|
||||
base.OnSpawn();
|
||||
if (_activateOnSpawn)
|
||||
Abilities.Get("e003_fall")?.Execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 场景预置路径:由场景触发器(EventTrigger / Animator Event)调用,触发天花板跌落。
|
||||
/// </summary>
|
||||
public void ActivateFromCeiling()
|
||||
{
|
||||
Abilities.Get("e003_fall")?.Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user