Пример #1
0
    void LateUpdate()
    {
        moveX = Mathf.Cos(Time.time * 5 * (offset + 12)) * source.volume;
        float x = originX + moveX;
        float y = Mathf.Lerp(transform.position.y, ((int)offset) * 6 - 72, instrument.GetPitchLerp() * 0.5f);

        transform.position = new Vector3(x, y);
        if (isSinging)
        {
            line.startColor = LINE_ON;
            line.endColor   = LINE_ON;
        }
        else
        {
            line.startColor = LINE_OFF;
            line.endColor   = LINE_OFF;
        }

        float pitch = Mathf.Pow(2, offset / 12f - 1);

        source.pitch = Mathf.Lerp(source.pitch, pitch, instrument.GetPitchLerp());
    }