摄像机区域的架构改动
This commit is contained in:
38
Assets/_Game/Scripts/Enemies/EnemyCombat.cs
Normal file
38
Assets/_Game/Scripts/Enemies/EnemyCombat.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using BaseGames.Combat;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>
|
||||
/// 敌人战斗组件(架构 07_EnemyModule §4)。
|
||||
/// HitBox 按 AttackType 索引管理,动画事件触发 HitBox 开关。
|
||||
/// </summary>
|
||||
public class EnemyCombat : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private HitBox[] _hitBoxes; // Inspector 按 AttackType 索引绑定
|
||||
|
||||
public void StartAttack(AttackType type)
|
||||
{
|
||||
int idx = (int)type;
|
||||
EnableHitBox(idx);
|
||||
}
|
||||
|
||||
public void EnableHitBox(int index)
|
||||
{
|
||||
if (_hitBoxes == null || index >= _hitBoxes.Length) return;
|
||||
_hitBoxes[index]?.Activate();
|
||||
}
|
||||
|
||||
public void DisableHitBox(int index)
|
||||
{
|
||||
if (_hitBoxes == null || index >= _hitBoxes.Length) return;
|
||||
_hitBoxes[index]?.Deactivate();
|
||||
}
|
||||
|
||||
public void DisableAllHitBoxes()
|
||||
{
|
||||
if (_hitBoxes == null) return;
|
||||
foreach (var hb in _hitBoxes) hb?.Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user