public void EndDialogue() { isDialoguePlayed = false; anim.SetBool("IsOpen", false); tempEvent?.Invoke(); tempEvent = null; }
public delegate void Event(); // declare delegate type public void TriggerDialog(EventDialogueFinished onDialogFinished = null) { var dialogueManager = FindObjectOfType <DialogManager>(); dialogue.eventDialogueFinished = onDialogFinished; if (!dialogueManager.isDialoguePlayed) { FindObjectOfType <DialogManager>().StartDialogue(dialogue); } }
// Update is called once per frame private void Update() { if (Vector3.Distance(PlayerManager.instance.Player.transform.position, transform.position) <= 2) { talktableTrigger.Play(); if (Input.GetKeyDown(KeyCode.E)) { OnDialogueFinished += CallbackOpenDoor; dialogueTrigger.TriggerDialog(OnDialogueFinished); } } else { if (talktableTrigger.IsTrigger()) { talktableTrigger.Stop(); } } }
public void StartDialogue(Dialog dialogue) { if (IsInteractOpen()) { CloseNearOfTalktable(); } anim.SetBool("IsOpen", true); isDialoguePlayed = true; sentences.Clear(); nameText.text = dialogue.name; foreach (string sentence in dialogue.sentences) { sentences.Enqueue(sentence); } tempEvent += dialogue.eventDialogueFinished; dialogue.hasBeenTriggered = true; DisplayNextScene(); }
private void Start() { isDialoguePlayed = false; sentences = new Queue <string>(); tempEvent = null; }