多轮审查评估

This commit is contained in:
2026-05-13 09:19:54 +08:00
parent 458f344e83
commit 1b37297585
57 changed files with 3019 additions and 218 deletions

View File

@@ -1,4 +1,6 @@
using BaseGames.Combat;
using BaseGames.Core;
using BaseGames.Core.Save;
using MoreMountains.Feedbacks;
using UnityEngine;
@@ -9,7 +11,7 @@ namespace BaseGames.World
/// 揭示后禁用碰撞体(不销毁),状态持久化到 WorldSaveData。
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class FalseWall : MonoBehaviour, IDamageable
public class FalseWall : MonoBehaviour, IDamageable, ISaveable
{
public enum RevealCondition { Proximity, AttackOnce, AlwaysOpen }
@@ -39,17 +41,39 @@ namespace BaseGames.World
// ── Unity Lifecycle ───────────────────────────────────────────────────
private void Awake()
{
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Register(this);
}
private void OnDestroy()
{
ServiceLocator.GetOrDefault<ISaveableRegistry>()?.Unregister(this);
}
private void Start()
{
if (_revealCondition == RevealCondition.AlwaysOpen)
{
SetPassThroughImmediate();
_isRevealed = true;
return;
}
}
// 读档恢复SaveManager 集成后接入 WorldSaveData.RevealedFalseWalls
// 示例bool revealed = ServiceLocator.GetOrDefault<SaveManager>()?.CurrentSave?.World?.RevealedFalseWalls?.Contains(_wallId) ?? false;
// if (revealed) SetPassThroughImmediate();
// ── ISaveable ─────────────────────────────────────────────────────────
public void OnSave(SaveData data)
{
if (_isRevealed && !string.IsNullOrEmpty(_wallId)
&& !data.World.OpenedDoors.Contains(_wallId))
data.World.OpenedDoors.Add(_wallId);
}
public void OnLoad(SaveData data)
{
if (string.IsNullOrEmpty(_wallId)) return;
_isRevealed = data.World.OpenedDoors.Contains(_wallId);
if (_isRevealed) SetPassThroughImmediate();
}
private void OnTriggerEnter2D(Collider2D other)