using Godot;
namespace ColdMint.scripts.map.miniMap;
///
/// Mini Map
/// 迷你地图
///
public partial class MiniMap : NinePatchRect
{
private Node2D? _roomPreviewContainer;
private Vector2 _miniMapMidpointCoordinate;
///
/// The midpoint coordinates of the mini map
/// 迷你地图的中点坐标
///
public Vector2 MiniMapMidpointCoordinate => _miniMapMidpointCoordinate;
///
/// The master node of the map
/// 地图的主人节点
///
public Node2D? OwnerNode { get; set; }
public override void _Ready()
{
_roomPreviewContainer = GetNode("RoomPreviewContainer");
_miniMapMidpointCoordinate = Size / 2;
}
public override void _Process(double delta)
{
if (_roomPreviewContainer == null)
{
return;
}
if (OwnerNode != null)
{
_roomPreviewContainer.Position = -OwnerNode.GlobalPosition / Config.CellSize * Config.RoomPreviewScale;
}
}
}