コード例 #1
0
 public override void Play()
 {
     IsPlaying = true;
     foreach (SoundVolumeAssociation association in TrackVolumes)
     {
         association.Sound.Volume = association.Volume;
         association.Sound.Play();
         ProceduralSound sound = association.Sound;
         Debug.Log("Vertical Remix Sound Playing: " + sound.name);
     }
 }
    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;
        }
    }
コード例 #3
0
 public void Add(string _key, ProceduralSound _newSound)
 {
     Sounds.Add(_key, _newSound);
 }