public void ActivateDialogueView(Character character, string[] options) { _dialogueView.SetActive(true); _isDialogueView = true; CanvasSettings.ToggleControl(false); _currentInteractingCharacter = character; _helpText.text = character.CharacterName; _name.text = ""; _lastScrollTime = Time.time; _currentDialogueIndex = 0; _dialogueList.Clear(); Vector3 nextPosition = Vector3.zero; foreach (string dialogue in options) { GameObject dialogueObject = Instantiate(_dialoguePrefab); dialogueObject.transform.SetParent(_dialogueView.transform, false); dialogueObject.GetComponent <Text>().text = dialogue; dialogueObject.transform.localPosition = nextPosition; nextPosition = new Vector3(0, nextPosition.y - dialogueObject.GetComponent <RectTransform>().rect.height, 0); _dialogueList.Add(dialogueObject); } SetCurrentDialogue(); }
public void DeactivateDialogueView() { _dialogueView.SetActive(false); CanvasSettings.ToggleControl(true); foreach (GameObject dialogue in _dialogueList) { Destroy(dialogue); } _dialogueList.Clear(); _currentDialogueIndex = 0; _isDialogueView = false; }