Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     count = 0;
     talk  = false;
     now   = GameManager.Chapter.Begin_movie;
     readFile(now.ToString());
 }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (now != gameManager.chapter)
        {
            count = 0;
            now   = gameManager.chapter;
            readFile(now.ToString());

            if (sentence.Count > 0)
            {
                talk = true;
                dialog.SetActive(true);
                dialogText.GetComponent <TypewriterEffect>().newWords = sentence[count];
            }
        }

        if (Input.GetKeyDown(KeyCode.Space) && talk)
        {
            if (dialogText.GetComponent <TypewriterEffect>().isActive)
            {
                dialogText.GetComponent <TypewriterEffect>().OnFinish();
            }
            else
            {
                count++;

                if (count < sentence.Count)
                {
                    dialogText.GetComponent <TypewriterEffect>().newWords = sentence[count];
                }
                else
                {
                    talk = false;
                    dialogText.GetComponent <Text>().text = "";
                    dialog.SetActive(false);
                }
            }
        }
    }