// Update is called once per frame void Update() { if (audio_ == null) { audio_ = GetComponent <AudioSource>(); if (audio_ == null) { return; } } float speed = movement_.GetSpeedPercentage(); audio_.volume = Mathf.Lerp(MinVolume, MaxVolume, speed); audio_.pitch = Mathf.Lerp(MinPitch, MaxPitch, speed); }