Ejemplo n.º 1
0
        public string[] FindVoices(DETAIL detail, Human.CULTIVATE cultivate, Human.CHARATYPE charaType)
        {
            string chara        = FirstCharToUpper(charaType.ToString());
            string cult         = FirstCharToUpper(cultivate.ToString());
            string detailStr    = detail.ToString();
            string lookupString = String.Format("{0}-{1}-{2}", chara, cult, detailStr);

            if (cacheResults && cache.ContainsKey(lookupString))
            {
                return(cache[lookupString]);
            }


            var results = new List <string>();

            int i = 0;

            foreach (var folder in GetFolderList(chara, cult, detailStr))
            {
                results.AddRange(GetMusicFiles(folder, i++ < 4));

                if (results.Count > 0 && useFallback)
                {
                    break;
                }
            }

            var resultsArr = results.ToArray();

            if (cacheResults)
            {
                cache[lookupString] = resultsArr;
            }

            return(resultsArr);
        }
Ejemplo n.º 2
0
        private object ChooseVoice(Human human)
        {
            AnanOneVoice.InfoText = String.Format("{0}/{1}/{2}", human.CharaType, human.Cultivate, Detail.ToString());

            string[] voices    = Finder.FindVoices(Detail, human.Cultivate, human.CharaType);
            var      fallbacks = GetFallbacks(human.Cultivate);

            // ↓ essentially a weighted random determination
            if (voices.Length > 0 && (!mergeWithOriginalVoices || UnityEngine.Random.Range(0, voices.Length + fallbacks.Count()) < voices.Length))
            {
                //System.Console.WriteLine("NO FALLBACK");
                var clip = voices[UnityEngine.Random.Range(0, voices.Length)];
                return(clip);
            }
            else
            {
                var fallbacksArr = fallbacks.ToArray();
                if (fallbacksArr.Length > 0)
                {
                    return(fallbacksArr[UnityEngine.Random.Range(0, fallbacksArr.Length)]);
                }
                else
                {
                    return(false);
                }
            }
        }