public void SetCurrentDialogue() { currentDialogue = dialogueQueue.Dequeue(); sentences.Clear(); names.Clear(); eventCode = Dialogue.EventCode.None; if (currentDialogue.getEventCode() != Dialogue.EventCode.None) { eventCode = currentDialogue.getEventCode(); if (currentDialogue.playBefore) { ExecuteDialogEvent(eventCode); } } foreach (string sentence in currentDialogue.GetSentences()) { sentences.Enqueue(sentence); } foreach (Dialogue.Names name in currentDialogue.GetNames()) { names.Enqueue(name); } DisplayNextSentence(); }
public void ExecuteDialogEvent(Dialogue.EventCode eventCode) { if (eventCode == Dialogue.EventCode.GameEnd_Spaceship) { GameObject.Find("GameController").GetComponent <LevelManager>().GoToOutroSpaceship(); } else if (eventCode == Dialogue.EventCode.Access_Repository) { foreach (GameObject obj in dialogueObjects) { Destroy(obj); } } else if (eventCode == Dialogue.EventCode.GameEnd_Repository) { GameObject.Find("GameController").GetComponent <LevelManager>().GoToOutroRepository(); } else if (eventCode == Dialogue.EventCode.Credits) { GetComponent <LevelManager>().GoToCredits(); } else if (eventCode == Dialogue.EventCode.Intro) { if (storyCount == story.Count) { Animator anim = GameObject.Find("AnimatedImage").GetComponent <Animator>(); anim.SetTrigger("Play"); anim.SetBool("ScreenOn", true); StartCoroutine(GetComponent <LevelManager>().GoToGame()); } else { StartDialogue(pathType.Story, null); } } else if (eventCode == Dialogue.EventCode.Death) { Animator anim = GameObject.Find("AnimatedImage").GetComponent <Animator>(); anim.SetTrigger("Play"); anim.SetBool("ScreenOn", false); } else { } }