void UpdateControlPoints() { int numPoints = (m_Waypoints == null) ? 0 : m_Waypoints.Length; if (numPoints > 1 && (Looped != m_IsLoopedCache || m_ControlPoints1 == null || m_ControlPoints1.Length != numPoints || m_ControlPoints2 == null || m_ControlPoints2.Length != numPoints)) { Vector4[] p1 = new Vector4[numPoints]; Vector4[] p2 = new Vector4[numPoints]; Vector4[] K = new Vector4[numPoints]; for (int i = 0; i < numPoints; ++i) { K[i] = m_Waypoints[i].AsVector4; } if (Looped) { SplineHelpers.ComputeSmoothControlPointsLooped(ref K, ref p1, ref p2); } else { SplineHelpers.ComputeSmoothControlPoints(ref K, ref p1, ref p2); } m_ControlPoints1 = new Waypoint[numPoints]; m_ControlPoints2 = new Waypoint[numPoints]; for (int i = 0; i < numPoints; ++i) { m_ControlPoints1[i] = Waypoint.FromVector4(p1[i]); m_ControlPoints2[i] = Waypoint.FromVector4(p2[i]); } m_IsLoopedCache = Looped; } }
private void UpdateControlPoints() { int num = (this.m_Waypoints == null) ? 0 : this.m_Waypoints.Length; if (num > 1 && (this.Looped != this.m_IsLoopedCache || this.m_ControlPoints1 == null || this.m_ControlPoints1.Length != num || this.m_ControlPoints2 == null || this.m_ControlPoints2.Length != num)) { Vector4[] array = new Vector4[num]; Vector4[] array2 = new Vector4[num]; Vector4[] array3 = new Vector4[num]; for (int i = 0; i < num; i++) { array3[i] = this.m_Waypoints[i].AsVector4; } if (this.Looped) { SplineHelpers.ComputeSmoothControlPointsLooped(ref array3, ref array, ref array2); } else { SplineHelpers.ComputeSmoothControlPoints(ref array3, ref array, ref array2); } this.m_ControlPoints1 = new CinemachineSmoothPath.Waypoint[num]; this.m_ControlPoints2 = new CinemachineSmoothPath.Waypoint[num]; for (int j = 0; j < num; j++) { this.m_ControlPoints1[j] = CinemachineSmoothPath.Waypoint.FromVector4(array[j]); this.m_ControlPoints2[j] = CinemachineSmoothPath.Waypoint.FromVector4(array2[j]); } this.m_IsLoopedCache = this.Looped; } }