Example #1
0
        /// <summary>
        /// Creates a new vertex spline.
        /// </summary>
        static public LinearSpline Linear(bool inbLooped, List <Vector3> inVertices)
        {
            LinearSpline spline = new LinearSpline(inVertices.Count);

            spline.SetLooped(inbLooped);
            spline.SetVertices(inVertices);
            return(spline);
        }
Example #2
0
        /// <summary>
        /// Creates a new vertex spline from the given transforms.
        /// </summary>
        static public LinearSpline Linear(bool inbLooped, Space inSpace, List <Transform> inVertices)
        {
            LinearSpline spline = new LinearSpline(inVertices.Count);

            spline.SetLooped(inbLooped);
            spline.SetVertices(inVertices, inSpace);
            return(spline);
        }
Example #3
0
        /// <summary>
        /// Creates a new vertex spline.
        /// </summary>
        static public LinearSpline Linear(bool inbLooped, params Vector3[] inVertices)
        {
            LinearSpline spline = new LinearSpline(inVertices.Length);

            spline.SetLooped(inbLooped);
            spline.SetVertices(inVertices);
            return(spline);
        }
Example #4
0
        /// <summary>
        /// Creates a new vertex spline from the given transforms.
        /// </summary>
        static public LinearSpline Linear(bool inbLooped, Space inSpace, params Transform[] inVertices)
        {
            LinearSpline spline = new LinearSpline(inVertices.Length);

            spline.SetLooped(inbLooped);
            spline.SetVertices(inVertices, inSpace);
            return(spline);
        }
Example #5
0
        private bool Generate(ref ISpline ioSpline)
        {
            bool bCreatedNew = false;

            switch (m_Type)
            {
            case GenType.Simple:
            {
                SimpleSpline s;
                if (ioSpline == null || ioSpline.GetSplineType() != SplineType.SimpleSpline)
                {
                    ioSpline    = s = new SimpleSpline(m_Vertices[0].Point, m_Vertices[1].Point, m_ControlPointA);
                    bCreatedNew = true;
                }
                else
                {
                    s = (SimpleSpline)ioSpline;

                    s.Start   = m_Vertices[0].Point;
                    s.End     = m_Vertices[1].Point;
                    s.Control = m_ControlPointA;

                    ioSpline = s;
                }
                break;
            }

            case GenType.Linear:
            {
                LinearSpline s;
                if (ioSpline == null || ioSpline.GetSplineType() != SplineType.LinearSpline)
                {
                    ioSpline    = s = new LinearSpline(m_Vertices.Length);
                    bCreatedNew = true;
                }
                else
                {
                    s = (LinearSpline)ioSpline;
                }

                s.SetLooped(m_Looped);
                s.SetVertices(m_Vertices);
                break;
            }

            case GenType.CSpline:
            {
                CSpline s;
                if (ioSpline == null || (ioSpline.GetSplineType() != SplineType.Cardinal && ioSpline.GetSplineType() != SplineType.CSpline))
                {
                    ioSpline    = s = new CSpline(m_Vertices.Length);
                    bCreatedNew = true;
                }
                else
                {
                    s = (CSpline)ioSpline;
                }

                s.SetAsCSpline();

                s.SetLooped(m_Looped);
                s.SetVertices(m_Vertices);
                break;
            }

            case GenType.Cardinal:
            {
                CSpline s;
                if (ioSpline == null || (ioSpline.GetSplineType() != SplineType.Cardinal && ioSpline.GetSplineType() != SplineType.CSpline))
                {
                    ioSpline    = s = new CSpline(m_Vertices.Length);
                    bCreatedNew = true;
                }
                else
                {
                    s = (CSpline)ioSpline;
                }

                s.SetAsCardinal(m_CRTension);

                s.SetLooped(m_Looped);
                s.SetVertices(m_Vertices);
                if (!m_Looped)
                {
                    s.SetControlPoints(m_ControlPointA, m_ControlPointB);
                }
                break;
            }

            default:
                throw new Exception("MultiSpline has not been properly set up in the inspector!");
            }

            return(bCreatedNew);
        }