75 lines
2.4 KiB
C#
75 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using Cielonos.MainGame.Map;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame
|
|
{
|
|
public partial class RunManager
|
|
{
|
|
/// <summary>
|
|
/// 地图查询与揭示接口。
|
|
/// 这里是纯 RunState 查询/写入层,不触发 Zone 加载,也不切换 RunPhase。
|
|
/// </summary>
|
|
public class RunMapQuerySubmodule : SubmoduleBase<RunManager>
|
|
{
|
|
public RunMapQuerySubmodule(RunManager owner) : base(owner)
|
|
{
|
|
}
|
|
|
|
public bool CanSelectMapNodes =>
|
|
owner.currentRun != null &&
|
|
owner.phaseSm.IsPhaseAllowingNodeSelection() &&
|
|
!owner.HasPendingCombatRewards;
|
|
|
|
public HashSet<Vector2Int> GetSelectablePositions()
|
|
{
|
|
if (!CanSelectMapNodes)
|
|
{
|
|
return new HashSet<Vector2Int>();
|
|
}
|
|
|
|
return MapFogCalculator.ComputeSelectableSet(owner.currentRun);
|
|
}
|
|
|
|
public Dictionary<Vector2Int, NodeDisplayState> GetAllNodeDisplayStates()
|
|
{
|
|
if (owner.currentRun == null)
|
|
{
|
|
return new Dictionary<Vector2Int, NodeDisplayState>();
|
|
}
|
|
|
|
return MapFogCalculator.Calculate(owner.currentRun);
|
|
}
|
|
|
|
public bool IsNodeExhausted(Vector2Int position)
|
|
{
|
|
return owner.currentRun != null && owner.currentRun.exhaustedNodes.Contains(position);
|
|
}
|
|
|
|
public void IncreaseScoutRange(int amount)
|
|
{
|
|
if (owner.currentRun == null) return;
|
|
|
|
owner.currentRun.scoutRange += amount;
|
|
Debug.Log($"[RunManager] 探测范围增加 {amount},当前:{owner.currentRun.scoutRange}");
|
|
}
|
|
|
|
public void RevealNode(Vector2Int position)
|
|
{
|
|
if (owner.currentRun == null) return;
|
|
|
|
owner.currentRun.permanentlyRevealedNodes.Add(position);
|
|
Debug.Log($"[RunManager] 永久揭示节点 {position}");
|
|
}
|
|
|
|
public void RevealNodeType(MapNodeType nodeType)
|
|
{
|
|
if (owner.currentRun == null) return;
|
|
|
|
owner.currentRun.permanentlyRevealedTypes.Add(nodeType);
|
|
Debug.Log($"[RunManager] 永久揭示所有 {nodeType} 类型节点");
|
|
}
|
|
}
|
|
}
|
|
}
|