Skip to content

Instantly share code, notes, and snippets.

@William-ST
Created July 19, 2017 14:19
Show Gist options
  • Save William-ST/340718656787a472fee5f482d10c7732 to your computer and use it in GitHub Desktop.
Save William-ST/340718656787a472fee5f482d10c7732 to your computer and use it in GitHub Desktop.
for (int i = 0; i < peoplesScene.Length; i++)
{
if (currentPeople <= changePeoples)
{
peoplesScene[i].SetActive(true);
currentPeople++;
if (i % 7 == 0) {
peoplesScene[i].GetComponent<Animator>().SetBool("distracted", true);
}
}
else
{
peoplesScene[i].SetActive(false);
}
}
for (int j = 0; j < tempAudioScene.Length; j++)
{
audioScene[j] = tempAudioScene[j].GetComponent<AudioSource>();
//Debug.Log("=== calculate ===");
float vol = (((1 - (float)changePeoples) * -1) / peoplesScene.Length);
//Debug.Log("deicmal - vol: "+vol);
//Debug.Log("audio "+j+" volumen ->"+vol);
if (1 - changePeoples < 1) {
//Debug.Log("if!!");
audioScene[j].volume = (vol/60);
} else {
audioScene[j].volume = 0;
}
audioScene[j].Play();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment