supervisor-simulator/scripts/ITileDraggable.cs
2026-01-18 20:05:23 +08:00

74 lines
1.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using Godot;
/// <summary>
/// 可拖拽图块接口
/// </summary>
public interface ITileDraggable {
/// <summary>
/// 图块在网格中的位置
/// </summary>
Vector2I TilePosition { get; set; }
/// <summary>
/// 是否允许拖拽
/// </summary>
bool Draggable { get; set; }
/// <summary>
/// 是否处于碰撞状态(例如位置无效或重叠)
/// </summary>
bool IsCollided { get; set; }
/// <summary>
/// 图块占据的矩形区域(相对于 TilePosition
/// </summary>
Rect2I TileRect { get; }
/// <summary>
/// 拖拽时鼠标相对于图块原点的偏移量
/// </summary>
Vector2I MouseOffset { get; }
/// <summary>
/// 特殊功能图块列表(如座位、交互点等)
/// </summary>
SpecialTile[] SpecialTiles { get; }
/// <summary>
/// 唯一标识符
/// </summary>
Guid Id { get; }
/// <summary>
/// 获取指定相对坐标处的图块类型
/// </summary>
/// <param name="pos">相对坐标</param>
/// <returns>地图节点类型</returns>
Lab.MapNodeType GetTileType(Vector2I pos);
/// <summary>
/// 特殊图块定义
/// </summary>
class SpecialTile {
/// <summary>
/// 节点类型(如可行走、作为座位等)
/// </summary>
public readonly Lab.MapNodeType NodeType;
/// <summary>
/// 相对位置
/// </summary>
public readonly Vector2I Position;
/// <summary>
/// 构造特殊图块
/// </summary>
/// <param name="pos">相对位置</param>
/// <param name="node">节点类型</param>
public SpecialTile(Vector2I pos, Lab.MapNodeType node) {
Position = pos;
NodeType = node;
}
}
}