Esempio n. 1
0
        //End dialogue
        void EndDialogue(IDialogueLine dialogue, CharacterSO actorSo)
        {
            // depending on the dialogue that ended, do something. The dialogue type can be different from the current dialogue type
            switch (dialogue.DialogueType)
            {
            case DialogueType.StartDialogue:
                // Check the validity of the step
                CheckTaskValidity();
                break;

            case DialogueType.WinDialogue:
                // After playing the win dialogue close Dialogue and end step

                break;

            case DialogueType.LoseDialogue:
                // closeDialogue
                // replay start Dialogue if the lose Dialogue ended
                if (_currentTask.StoryBeforeTask != null)
                {
                    _currentStory = _currentTask.StoryBeforeTask;
                }
                break;

            case DialogueType.DefaultDialogue:
                // close Dialogue
                // nothing happens if it's the default dialogue
                break;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Prepare DialogueManager when first time displaying DialogueData.
 /// <param name="storyDataSo"></param>
 /// </summary>
 private void BeginDialogueStory(SimpleStorySO storyDataSo)
 {
     inputReader.EnableDialogueInput();
     inputReader.advanceDialogueEvent += OnAdvance;
     m_CurrentStory  = storyDataSo;
     _isInputEnabled = false;
     StopAllCoroutines();
 }
Esempio n. 3
0
 // play dialogue of the story
 void PlayStoryDialogue()
 {
     if (defaultStory != null)
     {
         _currentStory = defaultStory;
         StartDialogue();
     }
 }
Esempio n. 4
0
 // register a step
 void RegisterTask(TaskSO task)
 {
     _currentTask = task;
     // Find me a story where the task belongs to.
     _currentStory = stories.FirstOrDefault((s) => s.ID == task.ParentId) ?? defaultStory;
     revisionId    = stories.FindIndex(s => s == _currentStory);
     Debug.Log(revisionId);
     _hasActiveTask = true;
 }
Esempio n. 5
0
 void PlayWinDialogue()
 {
     if (_currentTask != null)
     {
         if (_currentTask.WinStory != null)
         {
             _currentStory = _currentTask.WinStory;
             StartDialogue();
         }
     }
 }
Esempio n. 6
0
 void PlayLoseDialogue()
 {
     if (_currentTask != null)
     {
         if (_currentTask.LoseStory != null)
         {
             _currentStory = _currentTask.LoseStory;
             StartDialogue();
         }
     }
 }
Esempio n. 7
0
        // void EndTask()
        // {
        //  UnregisterTask();
        // }

        //unregister a step when it ends.
        private void UnregisterTask()
        {
            UpdateRevisionId();

            _currentTask    = null;
            _hasActiveTask  = false;
            _hasActiveStory = false;
            if (stories != null)
            {
                if (stories.Count > revisionId)
                {
                    _currentStory = stories.FirstOrDefault(s => !s.IsDone);
                }
            }
        }
Esempio n. 8
0
 // play default dialogue if no step
 void PlayDefaultDialogue()
 {
     if (defaultStory != null)
     {
         _currentStory = defaultStory;
         StartDialogue();
     }
     else
     {
         // if we have nothing to show go back to normal input
         if (onInteractionEnded != null)
         {
             onInteractionEnded.RaiseEvent();
         }
     }
 }
Esempio n. 9
0
 /// <summary>
 /// St
 /// </summary>
 void PlayTaskDialogue()
 {
     if (_currentTask != null)
     {
         // if we have a task check the validation
         if (_hasActiveTask)
         {
             CheckTaskValidity();
         }
         // The player is going to get a tasks handed over
         else if (_currentTask.StoryBeforeTask != null)
         {
             _currentStory = _currentTask.StoryBeforeTask;
             StartDialogue();
         }
         else
         {
             Debug.LogError("Task without dialogue registering not implemented.");
         }
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Displays DialogueData in the UI, one by one.
 /// Start interaction with the NPC
 /// </summary>
 /// <param name="storyDataSo"></param>
 public void Interact(SimpleStorySO storyDataSo)
 {
     BeginDialogueStory(storyDataSo);
     DisplayDialogueLine(storyDataSo.StartDialogue, storyDataSo.Character);
     ToggleCameras(true);
 }