Exemple #1
0
    IEnumerator Type(int index, int line)
    {
        foreach (var c in dialogues[index].lines[line])
        {
            if (dialogues[index].portrait != null)
            {
                imagePortrait.GetComponent <Image>().enabled = true;
                imagePortrait.GetComponent <Image>().sprite  = dialogues[index].portrait;
            }
            else
            {
                imagePortrait.GetComponent <Image>().enabled = false;
            }
            textDisplay.text += c;
            soundSource.clip  = dialogues[index].talkingSound;
            soundSource.Play();
            yield return(new WaitForSeconds(dialogues[index].talkingTime));
        }
        yield return(new WaitForSeconds(1f));

        if (GetNextLine(index, line) == 99)
        {
            Debug.Log("Fim de dialogo");
            yield return(new WaitForSeconds(.25f));

            sceneParse.ChangeScene(sceneParse.sceneToChange);
        }
        else
        {
            textDisplay.text = " ";
            StartCoroutine(Type(index, GetNextLine(index, line)));
        }
    }
 public void NextLevel()
 {
     //SceneManager.LoadScene((int)nextScene);
     parseScene.ChangeScene(AllScenes.Chicken_FimDeJogo);
 }