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

@@ -39,6 +39,8 @@ namespace BaseGames.Camera
[SerializeField] private CinemachineBrain _brain;
private UnityEngine.Camera _camera;
private CinemachineCamera _cachedVCam;
private CinemachineConfiner3D _cachedConfiner;
private void Reset()
{
@@ -77,7 +79,8 @@ namespace BaseGames.Camera
/// <summary>
/// 获取当前活跃 VCam 的 CinemachineConfiner3D 边界盒(世界空间 AABB
/// 用于在像素取整后将相机钳制回限位区域内。
/// 缓存上次查询的 VCam 实例;仅在活跃 VCam 发生切换时重新调用 GetComponent
/// 避免每帧 GetComponent 开销。
/// </summary>
private bool TryGetActiveConfinerBounds(out Bounds bounds)
{
@@ -85,9 +88,14 @@ namespace BaseGames.Camera
if (_brain == null) return false;
var vcam = _brain.ActiveVirtualCamera as CinemachineCamera;
if (vcam == null) return false;
var confiner = vcam.GetComponent<CinemachineConfiner3D>();
if (confiner == null || !confiner.IsValid) return false;
bounds = confiner.BoundingVolume.bounds;
// 只在活跃 VCam 切换时刷新缓存
if (!ReferenceEquals(vcam, _cachedVCam))
{
_cachedVCam = vcam;
_cachedConfiner = vcam.GetComponent<CinemachineConfiner3D>();
}
if (_cachedConfiner == null || !_cachedConfiner.IsValid) return false;
bounds = _cachedConfiner.BoundingVolume.bounds;
return true;
}

View File

@@ -114,7 +114,8 @@ namespace BaseGames.Camera
}
// 触发区域进入:更新集合(同一区域去重后重新加入,保证最新优先级)
_activeZones.RemoveAll(e => e.area == area);
for (int i = _activeZones.Count - 1; i >= 0; i--)
if (_activeZones[i].area == area) _activeZones.RemoveAt(i);
_activeZones.Add((area, priority));
// 仅当此区域是当前最优且尚未激活时才切换
@@ -132,7 +133,9 @@ namespace BaseGames.Camera
if (releasedArea == null) return;
bool wasActive = releasedArea == _currentArea;
int removed = _activeZones.RemoveAll(e => e.area == releasedArea);
int removed = 0;
for (int i = _activeZones.Count - 1; i >= 0; i--)
if (_activeZones[i].area == releasedArea) { _activeZones.RemoveAt(i); removed++; }
// 若区域本就不在栈中,且又不是当前激活区,则无需任何操作
if (removed == 0 && !wasActive) return;

View File

@@ -57,9 +57,14 @@ namespace BaseGames.Camera
// ── 静态:跨实例共享触发状态 ──────────────────────────────────────────
// 玩家当前物理上所在的所有触发区域(按进入顺序排列)
private static readonly List<CameraTriggerZone> s_InsideZones = new();
// 场景内所有已启用的触发区域,供 RoomController 等查询(替代 FindObjectsOfType
private static readonly List<CameraTriggerZone> s_AllZones = new();
// 当前已向 ICameraService 发出 SwitchArea 请求的触发区域
private static CameraTriggerZone s_ActiveZone;
/// <summary>场景内当前所有已启用的触发区域(只读)。</summary>
public static IReadOnlyList<CameraTriggerZone> AllZones => s_AllZones;
/// <summary>
/// 在每次进入 Play Mode 前(或禁用 Domain Reload 时的跨会话)重置静态状态,
/// 防止上一次游戏会话残留的区域引用导致触发逻辑错误。
@@ -68,6 +73,7 @@ namespace BaseGames.Camera
private static void ResetStaticState()
{
s_InsideZones.Clear();
s_AllZones.Clear();
s_ActiveZone = null;
}
@@ -77,12 +83,22 @@ namespace BaseGames.Camera
_collider.isTrigger = true;
}
private void OnEnable()
{
if (Application.isPlaying)
s_AllZones.Add(this);
}
private void OnDisable()
{
if (!Application.isPlaying) return;
s_AllZones.Remove(this);
HandlePlayerExit();
}
/// <summary>判断世界坐标点是否在本触发区域多边形内(供 RoomController 等无需 GetComponent 直接查询)。</summary>
public bool ContainsPoint(Vector2 worldPoint) => _collider != null && _collider.OverlapPoint(worldPoint);
/// <summary>
/// 若玩家出生时已在触发区域内OnTriggerEnter2D 不会触发。
/// 延迟一帧(确保 RoomController.Start 先完成基准区域设置)后主动检测。