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