public virtual IEnumerator StartDialogue() { dialogueTriggered = true; for (int i = 0; i < anims.Length; i++) { if (i != 0) // Only wait after the first dialogue line { yield return(new WaitForSeconds(2.0f)); } CharacterDialogueManager characterDialogueManager = characterDialogueManagers [i]; Animator anim = anims [i]; string dialogueLine = dialogueLines [i]; characterDialogueManager.SetDialogue(dialogueLine); anim.SetTrigger("playDialogue"); } }
public override IEnumerator StartDialogue() { dialogueTriggered = true; for (int i = 0; i < anims.Length; i++) { if (i != 0) // Only wait after the first dialogue line { yield return(new WaitForSeconds(2.0f)); } CharacterDialogueManager characterDialogueManager = characterDialogueManagers [i]; Animator anim = anims [i]; string dialogueLine = dialogueLines [i]; characterDialogueManager.SetDialogue(dialogueLine); anim.SetTrigger("playDialogue"); } yield return(new WaitForSeconds(4.0f)); SceneManager.LoadScene(2); // Change the next scene to be the next level }
//iterates through all the characters transforms void Update() { if (GameObject.Find("DialogueBox").GetComponent <Animator>().GetBool("IsOpen") == false) { foreach (Transform characterTransform in charactersTransformArray) { distance = Vector3.Distance(characterTransform.position, transform.position); if (distance < distanceToTriggerDialogue) { if (Input.GetButtonDown("Talk")) { //This deals with stopping the walking animation GameObject.Find("Player").GetComponent <PlayerMovement>() .setStopAnimation(true); CharacterDialogueManager characterDialogueManager = characterTransform. gameObject.GetComponent <CharacterDialogueManager>(); characterDialogueManager.interactWithCharacter(); } } } } }