示例#1
0
        private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height)
        {
            double Closest = pInfo.Point.GetDistance; //Initialized

            SquarePoint ClosestPoint = pInfo.Point;
            double      InfoOnSqare  = Height.GetState(pInfo.Point.X, pInfo.Point.Y);

            for (int i = 0; i < 8; i++)
            {
                SquarePoint Position = pInfo.Pos(i);
                if (!Position.InUse)
                {
                    continue;
                }

                if (Position.CanWalk)
                {
                    if (Height.GetState(Position.X, Position.Y) - InfoOnSqare <= 0.6 || Position.SquareData == 3) // 3 = chair?
                    {
                        double Distance = Position.GetDistance;
                        if (Closest > Distance)
                        {
                            Closest      = Distance;
                            ClosestPoint = Position;
                        }
                    }
                }
            }
            return(ClosestPoint);
        }
示例#2
0
        private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height)
        {
            double Closest = pInfo.Point.GetDistance; //Initialized

            SquarePoint ClosestPoint = pInfo.Point;
            double InfoOnSqare = Height.GetState(pInfo.Point.X, pInfo.Point.Y);

            for (int i = 0; i < 8; i++)
            {
                SquarePoint Position = pInfo.Pos(i);
                if (!Position.InUse)
                    continue;

                if (Position.CanWalk)
                {
                    if (Height.GetState(Position.X, Position.Y) - InfoOnSqare <= 0.6 || Position.SquareData == 3) // 3 = chair?
                    {
                        double Distance = Position.GetDistance;
                        if (Closest > Distance)
                        {
                            Closest = Distance;
                            ClosestPoint = Position;
                        }
                    }
                }
            }
            return ClosestPoint;
        }