コード例 #1
0
 void CheckTaskInvolvement(TaskSO task, TaskEventSO value)
 {
     if (character == task.Character)
     {
         RegisterTask(task);
     }
 }
コード例 #2
0
ファイル: StoryManager.cs プロジェクト: vamidi/StoryTime-UPM
        /// <summary>
        /// User is able to implement their own task validity.
        /// </summary>
        protected virtual void CheckTaskValidity()
        {
            if (m_CurrentStory != null && m_CurrentStory.Tasks != null && m_CurrentStory.Tasks.Count > m_CurrentTaskIndex)
            {
                m_CurrentTask = m_CurrentStory.Tasks[m_CurrentTaskIndex];
                switch (m_CurrentTask.Type)
                {
                case TaskCompletionType.Collect:
                    // Debug.Log($"Collecting task: {m_CurrentTask.ID}");
                    CheckCollectTask();
                    break;

                case TaskCompletionType.Defeat:
                    // Debug.Log($"Defeat task: {m_CurrentTask.ID}");
                    CheckDefeatTask();
                    break;

                case TaskCompletionType.Interact:
                    CheckInteraction();
                    break;

                case TaskCompletionType.Defend:
                    break;

                case TaskCompletionType.Talk:
                    // Debug.Log($"Talk task {m_CurrentTask.ID}");
                    // dialogue has already been played
                    TalkTask();
                    break;
                }
            }
        }
コード例 #3
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;
 }
コード例 #4
0
 void EndTask(TaskSO stepToFinish, TaskEventSO value)
 {
     if (stepToFinish == _currentTask)
     {
         UnregisterTask();
     }
     else
     {
         PlayTaskDialogue();
     }
 }
コード例 #5
0
ファイル: StoryManager.cs プロジェクト: vamidi/StoryTime-UPM
        /// <summary>
        ///
        /// </summary>
        protected virtual void EndTask()
        {
            m_CurrentTask = null;

            if (stories != null)
            {
                if (stories.Count > m_CurrentQuestIndex)
                {
                    if (stories[m_CurrentQuestIndex].Tasks != null)
                    {
                        if (stories[m_CurrentQuestIndex].Tasks.Count > m_CurrentTaskIndex)
                        {
                            TaskSO task = stories[m_CurrentQuestIndex].Tasks[m_CurrentTaskIndex];

                            if (endTaskEvent != null)
                            {
                                endTaskEvent.RaiseEvent(task, null);
                            }

                            // finish the task
                            task.FinishTask();

                            if (stories[m_CurrentQuestIndex].Tasks.Count > m_CurrentTaskIndex + 1)
                            {
                                m_CurrentTaskIndex++;

                                navigationInteractionUI.RaiseEvent(true, new StoryInfo
                                {
                                    // this is a new quest so grab the first quest.
                                    Story = m_CurrentStory,
                                    Index = m_CurrentTaskIndex,
                                    State = UI.StoryState.Update
                                }, InteractionType.Navigate);

                                StartTask();
                            }
                            else
                            {
                                navigationInteractionUI.RaiseEvent(true, new StoryInfo
                                {
                                    // this is a new quest so grab the first quest.
                                    Story = m_CurrentStory,
                                    Index = m_CurrentTaskIndex,
                                    State = UI.StoryState.Complete
                                }, InteractionType.Navigate);

                                EndStory();
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: StoryManager.cs プロジェクト: vamidi/StoryTime-UPM
        void StartTask()
        {
            if (m_CurrentStory.Tasks != null)
            {
                if (m_CurrentStory.Tasks.Count > m_CurrentTaskIndex)
                {
                    m_CurrentTask = m_CurrentStory.Tasks[m_CurrentTaskIndex];
                    m_CurrentTask.StartTask();

                    startTaskEvent.RaiseEvent(m_CurrentTask, null);
                }
            }
        }
コード例 #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);
                }
            }
        }
コード例 #8
0
ファイル: EnemyTracker.cs プロジェクト: vamidi/StoryTime-UPM
 public void StartTask(TaskSO task)
 {
     // Keep track if the task is to defeat and
     // the we are the type of monster he needs to slay
     m_Track = task.Type == TaskCompletionType.Defeat && task.EnemyCategory == enemy.Category;
 }