摄像机区域的架构改动

This commit is contained in:
2026-05-15 14:47:24 +08:00
parent 1b37297585
commit f264329751
3591 changed files with 1687228 additions and 446503 deletions

View File

@@ -0,0 +1,32 @@
using BaseGames.Combat;
using UnityEngine;
namespace BaseGames.Enemies
{
/// <summary>
/// 接触伤害:组件启用时持续激活 HitBox令敌人对接触到的目标定期造成伤害。
/// 适用于无攻击动画的简单障碍物、环境危险或测试场景。
/// </summary>
[RequireComponent(typeof(HitBox))]
public class BodyContactDamage : MonoBehaviour
{
[SerializeField] private float _repeatInterval = 0.5f;
private HitBox _hitBox;
private float _timer;
private void Awake() => _hitBox = GetComponent<HitBox>();
private void OnEnable() { _hitBox?.Activate(); _timer = 0f; }
private void OnDisable() => _hitBox?.Deactivate();
private void Update()
{
_timer += Time.deltaTime;
if (_timer >= _repeatInterval)
{
_timer = 0f;
_hitBox.Activate();
}
}
}
}