Пример #1
0
 // PLAY WATER FOOTSTEPS AND THE OTHER, LONGER SOUNDS.
 void PlayFootstepsOneshot(footstepsSoundClass sSound)
 {
     if (footstep_index >= sSound.soundsArray.Length)
     {
         footstep_index = 0;
         table_shuffler(sSound.soundsArray);
     }
     playNextStep = false;
     GetComponent<AudioSource>().volume = 1;
     GetComponent<AudioSource>().PlayOneShot(sSound.soundsArray[footstep_index++], sSound.Volume);
 }
Пример #2
0
    // PLAY FOOTSTEPS
    void PlayFootsteps(footstepsSoundClass sSound)
    {

        if (footstep_index >= sSound.soundsArray.Length)
        {
            footstep_index = 0;
            table_shuffler(sSound.soundsArray);
        }
        playNextStep = false;
        GetComponent<AudioSource>().clip = sSound.soundsArray[footstep_index++];
        GetComponent<AudioSource>().volume = Random.Range(sSound.Volume - 0.1F, sSound.Volume);
        GetComponent<AudioSource>().pitch = Random.Range(0.97F, 1.03F);
        GetComponent<AudioSource>().Play();
    }
Пример #3
0
    void PlayFootstepsTerrain(footstepsSoundClass sSound)
    {
        if (footstep_index >= sSound.soundsArray.Length)
        {
            footstep_index = 0;
            table_shuffler(sSound.soundsArray);
        }
        playNextStep = false;
        GetComponent<AudioSource>().clip = sSound.soundsArray[footstep_index++];
        GetComponent<AudioSource>().volume = Random.Range(sSound.Volume - 0.1F, sSound.Volume);
        GetComponent<AudioSource>().pitch = Random.Range(0.97F, 1.03F);
        GetComponent<AudioSource>().Play();

        if (sSoundPrev != sSound && sSoundPrev != null && footstepsAAOn)
        {
            GetComponent<AudioSource>().PlayOneShot(sSoundPrev.soundsArray[Random.Range(0, sSoundPrev.soundsArray.Length)], sSoundPrev.Volume / 2F);
        }
        sSoundPrev = sSound;
    }