Add WeaponFeedback component and AddressableManagerWindow meta file

- Implemented WeaponFeedback class for handling weapon-related feedbacks such as hit effects and attack sounds.
- Added meta file for AddressableManagerWindow to manage addressable assets.
- Included a new jump.data file for profiler data.
This commit is contained in:
2026-05-22 22:03:32 +08:00
parent 3e1f234ddc
commit b7baf7ad6a
44 changed files with 1783 additions and 1927 deletions

View File

@@ -19,6 +19,11 @@ namespace BaseGames.Combat
public event System.Action<DamageInfo> OnHitConfirmed;
private Coroutine _returnCoroutine;
// 按 duration 缓存 WaitForSeconds同一技能复用无 GC 分配
private WaitForSeconds _cachedWait;
private float _cachedWaitDuration = float.NaN;
private void Awake()
{
foreach (var hb in _hitBoxes)
@@ -35,7 +40,31 @@ namespace BaseGames.Combat
hb?.Activate(source, attacker);
}
/// <summary>duration 秒后自动销毁此 GameObject。</summary>
/// <summary>
/// duration 秒后归还对象池SetActive false
/// 由 SkillManager 对象池调用;替代旧版 Destroy 流程。
/// </summary>
public void AutoReturnAfter(float duration)
{
if (!Mathf.Approximately(_cachedWaitDuration, duration))
{
_cachedWaitDuration = duration;
_cachedWait = new WaitForSeconds(duration);
}
if (_returnCoroutine != null) StopCoroutine(_returnCoroutine);
_returnCoroutine = StartCoroutine(ReturnCoroutine());
}
private System.Collections.IEnumerator ReturnCoroutine()
{
yield return _cachedWait;
foreach (var hb in _hitBoxes)
hb?.Deactivate();
_returnCoroutine = null;
gameObject.SetActive(false); // 触发对象池回收
}
/// <summary>duration 秒后销毁(非池化路径,保留向后兼容)。</summary>
public void AutoDestroyAfter(float duration)
=> Destroy(gameObject, Mathf.Max(0f, duration));