Beispiel #1
0
 public void EndDialogue()
 {
     if (OnDialogueEnd != null)
     {
         OnDialogueEnd.Invoke();
     }
 }
        public static void Update()
        {
            if (_queue.Count != 0)
            {
                ShowNextDialogue();
            }

            if (IsShowingDialogue)
            {
                _dialogueBox.Update();
                if (GameWorld.GetPlayers()[0].IsSkipDialoguePressed() && !_skipDialogueButtonDown)
                {
                    _skipDialogueButtonDown = true;
                    Console.WriteLine("User is trying to skip dialogue.");
                    _dialogueBox.SkipDialogue();
                    // If skypping the dialogue caused it to end.
                    if (!_dialogueBox.IsActive)
                    {
                        OnDialogueEnd?.Invoke(-1);
                        Update();
                    }
                }
                if (!GameWorld.GetPlayers()[0].IsSkipDialoguePressed())
                {
                    _skipDialogueButtonDown = false;
                }
            }
        }
    public void EndDialogue()
    {
        OnDialogueEnd?.Invoke();
        this.gameObject.SetActive(false);

        dialogueText.text = "";
        dialogueQueue.Clear();
        isFinished = true;
    }
Beispiel #4
0
        /// <summary>
        /// Exit the dialogue.
        /// </summary>
        private void OnExit()
        {
            _canvas.enabled = false;

            ResetListeners();

            OnDialogueEnd?.Invoke();

            CancelInvoke();
        }
Beispiel #5
0
        //The player has clicked an option and the dialogue should now continue.
        //Which option is clicked is completely irrelevant rn
        public void Continue()
        {
            //advance the dialogue to the next bit.
            if (!dialogue.Advance(out Dialogue.DialogueSnippet snippet))
            {
                //TODO: handle the dialogue ending.
                npcGroup.DOFade(0, 1).PlayForward(); //TODO: OnComplete => free player so they can move again.
                OnDialogueEnd?.Invoke();
                //gameObject.SetActive(false);
                return;
            }

            ShowDialogue(snippet);
        }
Beispiel #6
0
 public void Hide()
 {
     if (OnDialogueEnd != null)
     {
         OnDialogueEnd.Invoke();
     }
     for (int i = 0; i < transform.childCount; i++)
     {
         if (transform.GetChild(i).GetType() != typeof(Button))
         {
             transform.GetChild(i).gameObject.SetActive(false);
         }
     }
 }
Beispiel #7
0
    void EndDialog(VD.NodeData data)
    {
        VD.OnNodeChange -= UpdateNode;
        VD.OnEnd        -= EndDialog;
        VD.EndDialogue(); //Third most important method when using VIDE

        dialogueMenu.gameObject.SetActive(false);


        if (OnDialogueEnd != null)
        {
            OnDialogueEnd.Invoke();
        }
    }
Beispiel #8
0
        private void DoDialogueEndSequence()
        {
            var sequence = DOTween.Sequence();

            //start by displaying the text.
            npcText.text = "";
            float textDuration = (float)dialogue.OutOfDialogueText.Length / textSpeed;

            sequence.Append(npcGroup.DOFade(1, 0.5f).OnComplete(() => npcAudioSource.PlayOneShot(npcVoiceClip)));
            sequence.Append(DOTween.To(() => npcText.text, x => npcText.text = x, dialogue.OutOfDialogueText, textDuration));

            //after a 2s delay, fade out what the npc is saying.
            sequence.Append(npcGroup.DOFade(0, 1).SetDelay(2f).OnComplete(() => OnDialogueEnd?.Invoke())); //TODO: OnComplete => free player so they can move again.

            //start the sequence.
            sequence.PlayForward();
        }
Beispiel #9
0
        void EmitDialogueEnd(Dialogue dialogue)
        {
            m_OnDialogueEnd.Invoke(dialogue);

            if (OnDialogueEnd != null)
            {
                OnDialogueEnd.Invoke(this, new DialogueEventArgs()
                {
                    dialogue = dialogue
                });
            }

            foreach (DialogueHandler dialogueHandler in m_dialogueHandlers)
            {
                dialogueHandler.HandleDialogueEnd(dialogue);
            }
        }
Beispiel #10
0
		public void EndDialogue()
		{
			dialogueBox.SetActive(false);

			dialogueText.text = "";
			titleText.text = "";

			StopAllCoroutines();

			currentLine = null;
			isActive = false;

            if(pauseDuringDialogue)
                Time.timeScale = 1f;

			OnDialogueEnd?.Invoke();
		}
Beispiel #11
0
        /// <summary>Returns an enumerator that waits for the dialogue to finish, resseting it when it has</summary>
        private IEnumerator DialogueRoutine(Dialogue dialogue, Action onFinish = null)
        {
            IsHoldingDialogue = true;
            backDrop.enabled  = true;

            dialogue.SetupDisplay(leftCharacterDisplay, rightCharacterDisplay);

            yield return(SetupDialogue());

            yield return(dialogue.Routine());

            dialogue.Restore();
            onFinish?.Invoke();

            ResetDisplayPositions();
            CheckForDeque();
            OnDialogueEnd?.Invoke();
        }
Beispiel #12
0
        /// <summary>
        ///     This method is called automatically once the dialogue line queue is empty, but it can be called to end the dialogue abruptly.
        ///		calls the OnDialogueEnd event, unpauses the game (if the setting is on) and disables the dialogue box.
        /// </summary>
        public void EndDialogue()
        {
            dialogueBox.gameObject.SetActive(false);

            dialogueText.text = "";
            if (titleText)
            {
                titleText.text = "";
            }

            StopAllCoroutines();

            currentLine = null;
            isActive    = false;

            if (pauseDuringDialogue)
            {
                Time.timeScale = 1f;
            }

            OnDialogueEnd?.Invoke();

            // If an agent or movable was blocked, sets them free
            if (agent)
            {
                // Input cooldown is needed because it uses the same "Interactable" button
                agent.InputCooldown();
                agent.canInteract = true;
            }
            if (movingAgent)
            {
                FinalInferno.CharacterOW.PartyCanMove = true;
                //movingAgent.CanMove = true;
            }
            agent       = null;
            movingAgent = null;

            // Triggers dialogue AfterDialogue method
            dialogue.AfterDialogue();
        }
 private void EndDialogue()
 {
     OnDialogueEnd?.Invoke();
     dialoguePanel.gameObject.SetActive(false);
 }
 public virtual void ExecuteOnDialogueEnd()
 {
     OnDialogueEnd.Invoke();
 }
Beispiel #15
0
 public override void SelectNode(GameObject user)
 {
     OnDialogueEnd?.Invoke(messages, user);
 }
Beispiel #16
0
 /// <summary>
 /// Exit out of the current passage.
 /// Can be used to forcibly exit out of a running, incompleted passage.
 /// </summary>
 public static void Exit()
 {
     isRunning = false;
     OnDialogueEnd.Invoke();
 }