private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height, bool bool_0, bool UserOverride, bool[,] iHeightOverride, int[,] GroupGates) { double num = pInfo.Point.GetDistance; SquarePoint result = pInfo.Point; double state = Height.GetState(pInfo.Point.X, pInfo.Point.Y); for (int i = 0; i < 8; i++) { SquarePoint squarePoint = pInfo.Pos(i); if (squarePoint.InUse && squarePoint.CanWalk && GroupGates[squarePoint.X, squarePoint.Y] == 0 && (squarePoint.WalkUnder ||(Height.GetState(squarePoint.X, squarePoint.Y) - state) <= 2.0|| UserOverride || iHeightOverride[squarePoint.X, squarePoint.Y])) { double getDistance = squarePoint.GetDistance; if (num > getDistance) { num = getDistance; result = squarePoint; } } } return result; }
private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height, bool bool_0, bool UserOverride, bool[,] iHeightOverride, int[,] GroupGates) { double num = pInfo.Point.GetDistance; SquarePoint result = pInfo.Point; double state = Height.GetState(pInfo.Point.X, pInfo.Point.Y); for (int i = 0; i < 8; i++) { SquarePoint squarePoint = pInfo.Pos(i); if (squarePoint.InUse && squarePoint.CanWalk && GroupGates[squarePoint.X, squarePoint.Y] == 0 && (squarePoint.WalkUnder || (Height.GetState(squarePoint.X, squarePoint.Y) - state) <= 2.0 || UserOverride || iHeightOverride[squarePoint.X, squarePoint.Y])) { double getDistance = squarePoint.GetDistance; if (num > getDistance) { num = getDistance; result = squarePoint; } } } return(result); }