예제 #1
0
        /// <summary>
        /// this allows you to fade Text anim
        /// </summary>
        /// <returns>Nothing</returns>
        public static IEnumerator TextFadeAnim(this Text text, string willBeText)
        {
            List <TextData> textDatas     = new List <TextData>();
            StringBuilder   stringBuilder = new StringBuilder(text.text.Length);

            text.text = string.Empty;

            for (short i = 0; i < text.text.Length; i++)
            {
                text.text       += Space;
                stringBuilder[i] = Space;
            }

            for (short i = 0; i < willBeText.Length; i++)
            {
                textDatas.Add(new TextData(willBeText[i], i));
            }

            while (textDatas.Count > 0)
            {
                var textData = textDatas[RandomReal.Range(0, textDatas.Count)];
                stringBuilder[textData.id] = textData._char;
                text.text = stringBuilder.ToString();
                textDatas.Remove(textData);
                yield return(TextUpdateTime);
            }
        }
예제 #2
0
        /// <summary>
        /// this allows you to Disolve Text anim
        /// </summary>
        /// <returns>Nothing</returns>
        public static IEnumerator TextDisolveAnim(this Text text)
        {
            StringBuilder   stringBuilder = new StringBuilder(text.text);
            List <TextData> textDatas     = new List <TextData>();

            for (short i = 0; i < text.text.Length; i++)
            {
                textDatas.Add(new TextData(text.text[i], i));
            }

            while (textDatas.Count > 0)
            {
                var textData = textDatas[RandomReal.Range(0, textDatas.Count)];
                stringBuilder[textData.id] = Space;
                text.text = stringBuilder.ToString();
                textDatas.Remove(textData);
                yield return(TextUpdateTime);
            }

            text.text = string.Empty;
            yield return(null);
        }
예제 #3
0
 public static T GetRandom <T>(this T[] array)
 {
     return(array[RandomReal.Range(0, array.Length)]);
 }