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:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user