多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine;
using BaseGames.Core.Events;
namespace BaseGames.World
{
/// <summary>
/// 死亡遗骸Death Shade。玩家死亡时在死亡地点留下遗骸
/// 再次到达并交互后回收存储的 Geo。
/// 实现 <see cref="IInteractable"/> 接口以接入通用交互系统。
/// </summary>
public class DeathShade : MonoBehaviour, IInteractable
{
[SerializeField] private IntEventChannelSO _onGeoRecovered;
[SerializeField] private StringEventChannelSO _onShadeCollected;
private int _storedGeo;
private string _sceneId;
// ── IInteractable ────────────────────────────────────────────────
public bool CanInteract => true;
public string InteractPrompt => "回收遗骸";
/// <summary>
/// 由死亡系统调用:设定存储 Geo 数量、所在场景 ID并移动到死亡坐标。
/// </summary>
public void Initialize(int geo, string sceneId, Vector2 position)
{
_storedGeo = geo;
_sceneId = sceneId;
transform.position = position;
}
public void OnPlayerEnterRange(Transform player) { }
public void OnPlayerExitRange() { }
/// <summary>
/// 玩家交互:广播 Geo 回收事件和场景标记,然后销毁自身。
/// PlayerStats 订阅 _onGeoRecovered 事件并自行添加 Geo保持零耦合。
/// </summary>
public void Interact(Transform player)
{
if (_storedGeo > 0)
_onGeoRecovered?.Raise(_storedGeo);
_onShadeCollected?.Raise(_sceneId);
Destroy(gameObject);
}
}
}