Пример #1
0
    private void OnDrawGizmos()
    {
        if (gizmo == null)
        {
            gizmo = new CurveFly(myCurveRoot.transform);
        }

        gizmo.RefreshTransforms(1f);

        if ((gizmo.myPoints.Length - 1) % 2 != 0)
        {
            return;
        }

        int     accur   = 50;
        Vector3 prevPos = gizmo.myPoints[0].position;

        for (int c = 0; c < accur; c++)
        {
            float   currTime = c * gizmo.GetDuration() / accur;
            Vector3 currPos  = gizmo.GetPositionAtTime(currTime);
            float   mag      = (currPos - prevPos).magnitude * 2;
            Gizmos.color = new Color(mag, 0, 0, 1);
            Gizmos.DrawLine(prevPos, currPos);
            Gizmos.DrawSphere(currPos, 0.01f);
            prevPos = currPos;
        }
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        myAudioSource = GetComponent <AudioSource>();

        curveFly = new CurveFly(myCurveRoot.transform);

        if (myAutoStart)
        {
            RefreshTransforms(mySpeed);
            FollowCurve();

            PlayUpSound();
        }
    }