示例#1
0
		private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height, bool CalculateDiagonal)
		{
			double getDistance = pInfo.Point.GetDistance;
			SquarePoint point = pInfo.Point;
			double state = Height.GetState(pInfo.Point.X, pInfo.Point.Y);
			for (int i = 0; i < 8; i++)
			{
				SquarePoint point2 = pInfo.Pos(i);
                if ((point2.InUse && point2.CanWalk) && (((Height.GetState(point2.X, point2.Y) - state) < 2.0)))
				{
					double num4 = point2.GetDistance;
					if (getDistance > num4)
					{
						getDistance = num4;
						point = point2;
					}
				}
			}
			return point;
		}
示例#2
0
        private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height, bool CalculateDiagonal)
        {
            double      getDistance = pInfo.Point.GetDistance;
            SquarePoint point       = pInfo.Point;
            double      state       = Height.GetState(pInfo.Point.X, pInfo.Point.Y);

            for (int i = 0; i < 8; i++)
            {
                SquarePoint point2 = pInfo.Pos(i);
                if ((point2.InUse && point2.CanWalk) && (((Height.GetState(point2.X, point2.Y) - state) < 2.0)))
                {
                    double num4 = point2.GetDistance;
                    if (getDistance > num4)
                    {
                        getDistance = num4;
                        point       = point2;
                    }
                }
            }
            return(point);
        }