2025-06-14 13:46:24 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace HxGame
|
|
|
|
|
|
{
|
|
|
|
|
|
public enum CELL_SIDE
|
|
|
|
|
|
{
|
|
|
|
|
|
TopLeft = 0,
|
|
|
|
|
|
Top = 1,
|
|
|
|
|
|
TopRight = 2,
|
|
|
|
|
|
BottomRight = 3,
|
|
|
|
|
|
Bottom = 4,
|
|
|
|
|
|
BottomLeft = 5,
|
|
|
|
|
|
Left = 6,
|
|
|
|
|
|
Right = 7
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class CellNode
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
//private readonly int _row;
|
|
|
|
|
|
//private readonly int _column;
|
|
|
|
|
|
private readonly int _x;
|
|
|
|
|
|
private readonly int _y;
|
|
|
|
|
|
private readonly int _index;
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD> <20><><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>赲<EFBFBD><E8B5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-15 20:14:45 +08:00
|
|
|
|
public CellType cellType = CellType.Obstacle;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
|
|
|
|
|
|
public int X { get { return _x; } }
|
|
|
|
|
|
public int Y { get { return _y; } }
|
|
|
|
|
|
public int index { get { return _index; } }
|
|
|
|
|
|
|
|
|
|
|
|
float[] _crossCost;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>ģ<EFBFBD>Ĭ<EFBFBD><C4AC>1.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public float[] crossCost
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _crossCost; }
|
|
|
|
|
|
set { _crossCost = value; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20>˵<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD>顣<EFBFBD><E9A1A3><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FindPath cellGroupMask<73><6B><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʹ<EFBFBD><CAB9>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int group = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ڱ༭<DAB1><E0BCAD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD><D3BF>߿<EFBFBD><DFBF>ܲ<EFBFBD><DCB2>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
|
|
|
|
|
|
public Vector3 GetPos(float width, float height)
|
|
|
|
|
|
{
|
|
|
|
|
|
float x = _x * width + width / 2;
|
|
|
|
|
|
float z = _y * height + height / 2;
|
|
|
|
|
|
return new Vector3(x, 0.03f, z);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-15 20:14:45 +08:00
|
|
|
|
public CellNode(int x, int y, int index, CellType type)
|
2025-06-14 13:46:24 +08:00
|
|
|
|
{
|
|
|
|
|
|
_x = x;
|
|
|
|
|
|
_y = y;
|
|
|
|
|
|
_index = index;
|
|
|
|
|
|
|
2025-06-15 20:14:45 +08:00
|
|
|
|
if (type == CellType.Safe)
|
|
|
|
|
|
cellType |= CellType.Safe;
|
2025-06-14 13:46:24 +08:00
|
|
|
|
else
|
|
|
|
|
|
cellType = type;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|