using System;
using ColdMint.scripts.utils;
using Godot;
namespace ColdMint.scripts.map.dateBean;
///
/// RoomSlot
/// 槽
///
public class RoomSlot
{
///
/// Return True if the slot already matches
/// 如果此槽已匹配,那么返回True
///
public bool Matched { get; set; }
///
/// The starting position of the room slot
/// 房间插槽的开始位置
///
///
///As opposed to a tile map. Convert to local location please call
///相对于瓦片地图而言的。转换为本地位置请调用
///
public Vector2I StartPosition { get; set; }
///
/// The end position of the room slot
/// 房间插槽的结束位置
///
///
///As opposed to a tile map. Convert to local location please call
///相对于瓦片地图而言的。转换为本地位置请调用
///
public Vector2I EndPosition { get; set; }
///
/// Is it a horizontal slot
/// 是水平方向的槽吗
///
public bool IsHorizontal => StartPosition.Y == EndPosition.Y;
///
/// Distance from the midpoint of the slot to the midpoint of the room (tile size)
/// 此槽的中点到房间中点的距离(瓦片尺寸)
///
///
///Element 1 represents left and right, element 2 represents up and down
///元素1,代表左右,元素2代表上下
///
public CoordinateUtils.OrientationDescribe[]? DistanceToMidpointOfRoom { get; set; }
public int Length =>
Math.Max(Math.Abs(EndPosition.X - StartPosition.X), Math.Abs(EndPosition.Y - StartPosition.Y)) + 1;
}