Exemplo n.º 1
0
        public override ProjectileMotionPoint GetFarthestPoint()
        {
            if (FarthestPointIndex < 0)
            {
                FarthestPointIndex = 0;

                int count = GetListAllPointsOfTrajectory().Count();

                for (int i = 1; i < count; i++)
                {
                    if (GetListAllPointsOfTrajectory()[i].GetDistance() < GetListAllPointsOfTrajectory()[FarthestPointIndex].GetDistance())
                    {
                        break;
                    }

                    FarthestPointIndex = i;
                }

                ProjectileMotionPoint final    = GetFinalPoint();
                ProjectileMotionPoint farthest = GetListAllPointsOfTrajectory()[FarthestPointIndex];

                if (final.GetDistance() > farthest.GetDistance())
                {
                    FarthestPointIndex = count - 1;
                    return(final);
                }

                return(farthest);
            }

            return(GetListAllPointsOfTrajectory()[FarthestPointIndex]);
        }