Esempio n. 1
0
    public void SetCurrentQuest(ActiveQuestBase quest)
    {
        quest.CleanUp();

        if (quest.Area != currentArea)
        {
            AreaChangeAndFadeObject.SetActive(true);
            AreaChangeInterpolater.StartLerping(() => {
                DataManager.Instance.Followers.Clear();
                DeadEnemyController.Instance.ClearEnemies();

                CurrentQuest.Value = quest;
                SetQuest(quest);

                quest.StartQuest(FinishQuest);

                AreaChangeInterpolater.StartReverseLerp(() => {
                    AreaChangeAndFadeObject.SetActive(false);

                    QuestDialogUI.SetConversation(quest.StartConversation, () => {
                        // Check that the quest isn't finished (for reach quests)
                        if (quest.IsFinished())
                        {
                            FinishQuest(quest);
                        }

                        if (quest is BossQuest)
                        {
                            InteractionController.Instance.StartBossFight();
                        }
                    });
                });
            });
        }
        else
        {
            CurrentQuest.Value = quest;
            SetQuest(quest);

            quest.StartQuest(FinishQuest);

            QuestDialogUI.SetConversation(quest.StartConversation, () => {
                if (quest.IsFinished())
                {
                    FinishQuest(quest);
                }

                if (quest is BossQuest)
                {
                    InteractionController.Instance.StartBossFight();
                }
            });
        }

        currentArea = quest.Area;
    }
Esempio n. 2
0
 private void FinishQuest(ActiveQuestBase quest)
 {
     quest.CleanUp();
     StatTracker.Instance.CompleteQuest(quest);
     if (quest.NextQuest != null)
     {
         CurrentQuest.Value = quest.NextQuest;
     }
     QuestDialogUI.SetConversation(quest.EndConversation, () => DropRewardAndAdvanceConversation(quest));
 }
Esempio n. 3
0
    private void AdvanceQuestAfterConversation(ActiveQuestBase q)
    {
        q.CleanUp();

        if (q.NextQuest == null)
        {
            PopUp.SetPopUp(
                "You finished the quest! You may either continue in this area or switch quests using the quest book on your screen.",
                new[] { "ok" }, new Action[] {
                () => { }
            });
            return;
        }

        SetCurrentQuest(q.NextQuest);
    }