46 lines
957 B
C#
46 lines
957 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Aula5_RestaurantSpeach : MonoBehaviour
|
|
{
|
|
public void SetInfo(string text)
|
|
{
|
|
StartCoroutine(WriteText(text));
|
|
|
|
StartCoroutine(ScaleUP());
|
|
}
|
|
|
|
IEnumerator ScaleUP()
|
|
{
|
|
transform.localScale = Vector3.zero;
|
|
|
|
float nbr = 0;
|
|
while (nbr < 1)
|
|
{
|
|
nbr += Time.deltaTime * 3;
|
|
|
|
transform.localScale = new Vector3(nbr, nbr, nbr);
|
|
|
|
yield return new WaitForEndOfFrame();
|
|
}
|
|
|
|
transform.localScale = new Vector3(1, 1, 1);
|
|
}
|
|
|
|
IEnumerator WriteText(string text)
|
|
{
|
|
Text txtWrite = GetComponentInChildren<Text>();
|
|
|
|
for (int i = 0; i < text.Length; i++)
|
|
{
|
|
txtWrite.text = text.Remove(i);
|
|
|
|
yield return new WaitForSecondsRealtime(.02f);
|
|
}
|
|
|
|
txtWrite.text = text;
|
|
}
|
|
}
|