namespace M2Server
{
public struct TTerrainParam
{
public Color CellColor;
public string[] CellLabel;
public int MoveCost;
}
// 路径数组
public struct TPathMapCell
{
// 路径图元
public int Distance;
// 离起点的距离
public int Direction;
}
public struct TCellParams
{
public TTerrainTypes TerrainType;
public bool OnPath;
}
public class TPathMap
{
public TPathMapCell[,] PathMapArray; //路径图存储数组
public int Height = 0;
public int Width = 0;
public TRect ClientRect = null;
public int ScopeValue = 0;// 寻找范围
public bool StartFind = false;
public TPathMap()
: base()
{
ScopeValue = 24;// 寻路范围
}
// *************************************************************
// 方向编号转为X方向符号
// 7 0 1
// 6 X 2
// 5 4 3
// *************************************************************
private int DirToDX(int Direction)
{
int result;
switch (Direction)
{
case 0:
case 4:
result = 0;
break;
case 1:
case 2:
case 3:
result = 1;
break;
default:
result = -1;
break;
}
return result;
}