public override void Play() { IsPlaying = true; Debug.Log("Playing HORIZONTAL RESEQUENCER PROCEDURAL SOUND"); Debug.Log("OBJECT NAME: " + gameObject.name); Current.Play(); }
public void PlayNext() { Debug.Log("PlayNEXT"); float total_probability = 0.0f; foreach (string key in Tracks.Keys) { if (key == "") { continue; } Debug.Log("Track in HR: " + Tracks[key].name); total_probability += Tracks[key].Probability; } if (total_probability != 1.0f) { Debug.LogError("Total probability for Horizontal Resequencing Tracks DOES NOT SUM TO 1.0f!"); return; } float current_value = 0.0f; float number = Random.Range(0.0f, 1.0f); Debug.Log(number); foreach (string key in Tracks.Keys) { if (Utilities.FloatIsBetween(number, current_value, current_value + Tracks[key].Probability)) { Current = Tracks[key].Sound; Current.Play(); Debug.Log("HR playing: " + Current.name); return; } current_value += Tracks[key].Probability; } }