Пример #1
0
        private void BuildMeshAlongCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float zOffset)
        {
            Vector3[] vertices = m_vertices;
            Vector2?  vector   = null;
            Vector2   v        = p3 - p0;
            Vector2   vector2  = (Quaternion.Euler(0f, 0f, 90f) * v).XY();

            for (int i = 0; i < 10; i++)
            {
                Vector2 vector3 = BraveMathCollege.CalculateBezierPoint(i / 9f, p0, p1, p2, p3);
                Vector2?vector4 = (i != 9) ? new Vector2?(BraveMathCollege.CalculateBezierPoint(i / 9f, p0, p1, p2, p3)) : null;
                Vector2 a       = Vector2.zero;
                if (vector != null)
                {
                    a += (Quaternion.Euler(0f, 0f, 90f) * (vector3 - vector.Value)).XY().normalized;
                }
                if (vector4 != null)
                {
                    a += (Quaternion.Euler(0f, 0f, 90f) * (vector4.Value - vector3)).XY().normalized;
                }
                a = a.normalized;
                float d = Mathf.Lerp(StartWidth, EndWidth, i / 9f);
                vector3            += vector2.normalized * Mathf.Sin(Time.realtimeSinceStartup * SinSpeed + i * WavelengthMod) * AmplitudeMod * (i / 9f);
                vertices[i * 2]     = (vector3 + a * d).ToVector3ZisY(zOffset);
                vertices[i * 2 + 1] = (vector3 + -a * d).ToVector3ZisY(zOffset);
                vector = new Vector2?(vector3);
            }
        }
        // Token: 0x0600694B RID: 26955 RVA: 0x00293194 File Offset: 0x00291394
        private void BuildMeshAlongCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float meshWidth = 0.03125f)
        {
            Vector3[] vertices = this.m_vertices;
            Vector2?  vector   = null;

            for (int i = 0; i < 10; i++)
            {
                Vector2 vector2 = BraveMathCollege.CalculateBezierPoint((float)i / 9f, p0, p1, p2, p3);
                Vector2?vector3 = (i != 9) ? new Vector2?(BraveMathCollege.CalculateBezierPoint((float)i / 9f, p0, p1, p2, p3)) : null;
                Vector2 a       = Vector2.zero;
                if (vector != null)
                {
                    a += (Quaternion.Euler(0f, 0f, 90f) * (vector2 - vector.Value)).XY().normalized;
                }
                if (vector3 != null)
                {
                    a += (Quaternion.Euler(0f, 0f, 90f) * (vector3.Value - vector2)).XY().normalized;
                }
                a = a.normalized;
                vertices[i * 2]     = (vector2 + a * meshWidth).ToVector3ZisY(0f);
                vertices[i * 2 + 1] = (vector2 + -a * meshWidth).ToVector3ZisY(0f);
                vector = new Vector2?(vector2);
            }
        }