コード例 #1
0
    static void PlayPerson(List <string> list)
    {
        //if a sound for a lang is not being added yet just return
        if (list.Count == 0)
        {
            return;
        }

        //the root is determined by the languages and the type of person
        //English/Man/ is an ex

        var buildRoot = list[Random.Range(0, list.Count)];
        var key       = buildRoot.Substring(infoIndex, buildRoot.Length - (4 + infoIndex));

        //Debug.Log("Key: " + key);
        //Debug.Log("buildRoot: " + buildRoot);

        if (!_audioContainers.ContainsKey(key))
        {
            var audioConta = AudioContainer.Create(key, key, 20,
                                                   container: AudioPlayer.SoundsCointaner.transform);
            _audioContainers.Add(key, audioConta);
            _languages.Add(key, buildRoot + key);
        }
        else
        {
            _audioContainers[key].PlayAShot(20);//15 is half way
        }
    }
コード例 #2
0
    /// <summary>
    /// The first 10 items will be pplayed by its Audio Container
    /// </summary>
    /// <param name="item"></param>
    private static void OnTheFirst40Items(KeyValuePair <string, AudioReport> item)
    {
        //if is there will be set to  a NewLevel()
        if (_audioContainers.ContainsKey(item.Key))
        {
            _audioContainers[item.Key].Play(item.Value.AverageDistance());
        }
        //Other wise will be spawned
        else
        {
            if (!_roots.ContainsKey(item.Key))
            {
                return;
            }

            if (string.IsNullOrEmpty(_roots[item.Key]))
            {
                _roots[item.Key] = DefineRoot(item.Key);
            }
            var root = _roots[item.Key];

            _audioContainers.Add(item.Key, AudioContainer.Create(item.Key, root, item.Value.AverageDistance(),
                                                                 container: AudioPlayer.SoundsCointaner.transform));
        }
    }
コード例 #3
0
    private static void LoadAMusic(KeyValuePair <string, string> item)
    {
        var root = DefineRoot(item.Key);

        var audCont = AudioContainer.Create(item.Key, root, 0,
                                            container: AudioPlayer.SoundsCointaner.transform);

        LevelChanged += audCont.LevelChanged;

        _musics.Add(item.Key, audCont);
    }