Files
zeling_v2/Assets/_Game/Scripts/Enemies/E003_YouZhi.cs

35 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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();
}
}
}