Example #1
0
 public void SetQuestProgress(int questId, Quest.QuestProgress progress)
 {
     if (masterQuestDictionary.ContainsKey(questId))
     {
         masterQuestDictionary[questId].ChangeState(progress);
     }
 }
Example #2
0
 public void SetQuestStatus(int questID, Quest.QuestProgress status)
 {
     foreach (Quest q in currentQuests)
     {
         if (questID == q.questID)
         {
             int index = currentQuests.IndexOf(q);
             currentQuests[index].questProgress = status;
         }
     }
 }
Example #3
0
    public List <Quest> GetQuestsByStatus(Quest.QuestProgress progress)
    {
        List <Quest> questList = new List <Quest>();

        foreach (Quest q in currentQuests)
        {
            if (q.questProgress == progress)
            {
                questList.Add(q);
            }
        }
        return(questList);
    }
Example #4
0
 public QuestSave(Quest quest)
 {
     questID     = quest.questID;
     questName   = quest.questTitle;
     questStatus = quest.questProgress;
 }
Example #5
0
    public void DisplayDialog()
    {
        if (!npc.dialogBox.activeSelf)
        {
            Quest.QuestProgress statusTest = questToGive.questProgress;

            Time.timeScale = 0f;

            GameManager.gm.data.overviewMap.SetActive(false);

            switch (statusTest)
            {
            case Quest.QuestProgress.AVAILABLE:
                npc.dialogText.text = questToGive.questDesc;
                GiveQuest();
                break;

            case Quest.QuestProgress.CURRENT:
            case Quest.QuestProgress.ACCEPTED:
                npc.dialogText.text = questToGive.questDesc;
                break;

            case Quest.QuestProgress.COMPLETED:
                npc.dialogText.text = questToGive.questCompleteText;
                if (questType == Quest.QuestType.FIND_ITEM)
                {
                    FindItem quest = (FindItem)questToGive;
                    quest.RemoveItem();
                }
                if (questType == Quest.QuestType.KILL)
                {
                    KillQuest quest = (KillQuest)questToGive;
                }
                if (questType == Quest.QuestType.LOCATION)
                {
                    LocateQuest quest = (LocateQuest)questToGive;
                }
                if (questType == Quest.QuestType.AWAKEN)
                {
                    AwakenQuest quest = (AwakenQuest)questToGive;
                }
                QuestManager.questManager.SetQuestStatus(questToGive.questID, Quest.QuestProgress.DONE);
                break;

            case Quest.QuestProgress.DONE:
                npc.dialogText.text = questToGive.questDoneText;
                questToGive.GiveRewards();
                if (questToGive.nextQuest == -1)
                {
                    this.gameObject.GetComponent <NonPlayerCharacter>().questToken.SetActive(false);
                    npc.isQuestGiver = false;
                    break;
                }
                questToGive = QuestManager.questManager.GetQuestById(questToGive.nextQuest);
                QuestManager.questManager.SetQuestStatus(questToGive.questID, Quest.QuestProgress.AVAILABLE);
                QuestManager.questManager.AcceptQuest(questToGive);
                questType = questToGive.questType;
                break;

            default:
                break;
            }

            Button button = Instantiate(npc.buttonPrefab, npc.displayBoard.transform) as Button;
            button.GetComponentInChildren <TextMeshProUGUI>().text = "Click to dismiss";
            button.onClick.AddListener(delegate
            {
                npc.CloseDialog();
            });

            npc.dialogBox.SetActive(true);
        }
        else
        {
            Time.timeScale = 1f;
            npc.dialogBox.SetActive(false);
            GameManager.gm.data.overviewMap.SetActive(true);
        }

        NPCManager.npcManager.UpdateNPCList(npc.ID, questToGive, npc.talkNotifier.activeSelf, npc.questToken.activeSelf);
    }