Пример #1
0
        void OnDrawGizmos()
        {
            if (m_CameraPathRootObject != null)
            {
                List <Transform> childrenTransforms = new List <Transform>(m_CameraPathRootObject.GetComponentsInChildren <Transform>());

                childrenTransforms.Remove(m_CameraPathRootObject.transform);
                childrenTransforms.Sort(delegate(Transform t1, Transform t2)
                {
                    return(t1.name.CompareTo(t2.name));
                });

                m_PathTransforms = childrenTransforms.ToArray();

                if (m_SplineInterpolator == null)
                {
                    m_SplineInterpolator = this.gameObject.GetComponent <SplineInterpolator>();
                    if (m_SplineInterpolator == null)
                    {
                        m_SplineInterpolator = this.gameObject.AddComponent <SplineInterpolator>();
                    }
                }

                m_SplineInterpolator.SetupSplineInterpolator(m_PathTransforms);

                Vector3 prevPos = m_PathTransforms[0].position;
                for (int c = 1; c <= 100; c++)
                {
                    float   currTime = c * 1.0f / 100;
                    Vector3 currPos  = m_SplineInterpolator.GetHermiteAtTime(currTime);
                    float   mag      = (currPos - prevPos).magnitude * 2;
                    Gizmos.color = new Color(mag, 0, 0, 1);
                    Gizmos.DrawLine(prevPos, currPos);
                    prevPos = currPos;
                }
            }
        }