Files
HX_MapEditor/Assets/Scripts/PathFinding/PathFinder.cs
2025-06-14 13:46:24 +08:00

50 lines
969 B
C#

using System.Collections.Generic;
namespace HxGame.PathFinding
{
public struct PathFinderNode
{
public float F;
public float G;
public float H; // f = gone + heuristic
public int X;
public int Y;
public int PX; // Parent
public int PY;
}
public enum PathFinderNodeType
{
Start = 1,
End = 2,
Open = 4,
Close = 8,
Current = 16,
Path = 32
}
//ÏûºÄËã·¨
public enum HeuristicFormula
{
Manhattan = 1,
MaxDXDY = 2,
DiagonalShortCut = 3,
Euclidean = 4,
EuclideanNoSQR = 5,
Custom1 = 6
}
internal class ComparePFNode : IComparer<PathFinderNode>
{
public int Compare(PathFinderNode x, PathFinderNode y)
{
if (x.F > y.F)
return 1;
else if (x.F < y.F)
return -1;
return 0;
}
}
}