void FindTextAnimator() { Transform targetTrans = this.transform; _dialogueCanvas = GameObject.FindGameObjectWithTag("Dialogue"); _audioSource = _dialogueCanvas.GetComponentInChildren <AudioSource>(); _dialogueHistory = _dialogueCanvas.GetComponentInChildren <DialogueHistory>(); //Looks for the GameObject with the DialogueController.cs attached (First part of acquiring the TextAnimator and TextAnimatorPlayer) foreach (Transform child in _dialogueCanvas.transform) { if (child.GetComponent <DialogueController>()) { //Gets the child of the GameObject that has the DialogueController.cs attached to it targetTrans = child.transform.GetChild(0); } } //Second part of acquiring the TextAnimator and TextAnimatorPlayer if (targetTrans != null) { //Looks for the GameObject with the TextAnimator and TextAnimatorPlayer attached foreach (Transform child2 in targetTrans) { if (child2.GetComponent <TextAnimator>()) { _textAnimator = child2.GetComponent <TextAnimator>(); } if (child2.GetComponent <TextAnimatorPlayer>()) { _textAnimatorPlayer = child2.GetComponent <TextAnimatorPlayer>(); } } if (_textAnimatorPlayer != null) { _textAnimator.timeScale = TextAnimator.TimeScale.Scaled; } } }
public GameObject historyDialogueUI; //历史对话UI private void Awake() { _dialogueHistory = this; gameObject.SetActive(false); }