Ejemplo n.º 1
0
    //public float testSpeed = 0;

    float GetZTurbulence(float forwardWindSpeed)
    {
        float v = Mathf.Clamp01(Mathf.Abs(forwardWindSpeed / terminalFrontSpeed) - windBoost.GetWindBoost().magnitude);

        //v = testSpeed;

        if (v > 0.8)
        {
            return(0);
        }

        if (zTurbulence == 0)
        {
            zTurbulencePeriod = 0.5f + Random.Range(0f, 1f) * 3 * (1 - v);
        }

        zTurbulence += Time.deltaTime * Mathf.PI * 2 / zTurbulencePeriod;
        if (zTurbulence > 2 * Mathf.PI)
        {
            zTurbulence = 0;
        }

        float magnitude = turbulenceMagnitudeZ * (1 - v);
        float t         = Mathf.Sin(zTurbulence) * magnitude;

        //Debug.Log(t);

        return(t);
    }
Ejemplo n.º 2
0
    private void updateWindSound()
    {
        float wspeed = rigidbody.velocity.magnitude;
        float boost  = windBoost.GetWindBoost().magnitude / windBoost.windSpeed;

        WindAudio.volume = wspeed / 10 + boost * 0.5f;

        float pitchExcursion = 2f;

        WindAudio.pitch = 1 - pitchExcursion * .5f + WindAudio.volume * pitchExcursion;
    }