public static IConfigurableIndexedWaypointPath GetPath(WaypointPathComponent c, bool cloneWaypoints)
        {
            IConfigurableIndexedWaypointPath path = null;

            switch (c._pathType)
            {
            case PathType.Cardinal:
                path = new CardinalSplinePath();
                break;

            case PathType.Linear:
                path = new LinearPath();
                break;

            case PathType.BezierChain:
                path = new BezierChainPath();
                break;

            case PathType.BezierSpline:
                path = new BezierSplinePath();
                break;
            }
            if (path != null)
            {
                path.IsClosed = c._closed;
                if (c._waypoints != null)
                {
                    for (int i = 0; i < c._waypoints.Length; i++)
                    {
                        if (cloneWaypoints)
                        {
                            path.AddControlPoint(new Waypoint(c._waypoints[i]));
                        }
                        else
                        {
                            path.AddControlPoint(c._waypoints[i]);
                        }
                    }
                }
            }
            return(path);
        }
        public static IConfigurableIndexedWaypointPath GetPath(PathType type, IEnumerable <IWaypoint> waypoints, bool isClosed, bool cloneWaypoints)
        {
            IConfigurableIndexedWaypointPath path = null;

            switch (type)
            {
            case PathType.Cardinal:
                path = new CardinalSplinePath();
                break;

            case PathType.Linear:
                path = new LinearPath();
                break;

            case PathType.BezierChain:
                path = new BezierChainPath();
                break;

            case PathType.BezierSpline:
                path = new BezierSplinePath();
                break;
            }
            if (path != null)
            {
                path.IsClosed = isClosed;
                foreach (var wp in waypoints)
                {
                    if (cloneWaypoints)
                    {
                        path.AddControlPoint(new Waypoint(wp));
                    }
                    else
                    {
                        path.AddControlPoint(wp);
                    }
                }
            }
            return(path);
        }