private void QuestCompleted(I_Quest quest) { quest.QuestComplete(); RemoveQuest(quest); playerStats.Gold += quest.GoldReward; playerStats.Experience += quest.ExpReward; Inventory.Instance.UpdateStatInfo(); }
public void Interact() { string possibleQuestID = QuestManager.Instance.FindRelevancy(transform.name); qManager.CharacterInteraction(gameObject.name); if (questGiver) { if (questHanded) { if (QuestManager.Instance.GetQuest(FriendlyQuestIDList[questIndex]).QuestCompleted) { GenerateDialog(QuestManager.Instance.GetQuest(FriendlyQuestIDList[questIndex]).QuestEndDialog); questHanded = false; if (questIndex + 1 < FriendlyQuestIDList.Length) { questIndex++; questAvailable = true; } else { questAvailable = false; } } else { GenerateDialog(dialogueTree[0].dialogues[Random.Range(0, dialogueTree[0].dialogues.Length)]); } } else { if (questAvailable) { I_Quest quest = qManager.GetQuest(FriendlyQuestIDList[questIndex]); GenerateQuestOffer(quest.QuestGiverDialog, quest.GoldReward, quest.ExpReward); } else { GenerateDialog(dialogueTree[1].dialogues[Random.Range(0, dialogueTree[1].dialogues.Length)]); } } } else if (possibleQuestID != null) { Debug.Log("Sup"); GenerateDialog(QuestManager.Instance.GetQuest(possibleQuestID).QuestEndDialog); } else { GenerateDialog(dialogueTree[0].dialogues[Random.Range(0, dialogueTree[0].dialogues.Length)]); } }
public void AddQuest(I_Quest questToAdd) { GameObject newQuestEntry = GameObject.Instantiate(entryPrefab); newQuestEntry.transform.GetChild(0).GetComponent <Text>().text = questToAdd.QuestName; newQuestEntry.transform.GetChild(1).GetComponent <Text>().text = questToAdd.QuestDescription; newQuestEntry.transform.SetParent(refQuestLog.transform); for (int i = 0; i < questToAdd.QuestObjectives.Count; i++) { newQuestEntry.transform.GetChild(2).transform.GetChild(i).GetComponent <Text>().text = questToAdd.QuestObjectives[i].ObjectiveDescription; newQuestEntry.transform.GetChild(3).transform.GetChild(i).GetComponent <Text>().text = questToAdd.QuestObjectives[i].ObjectiveProgress + "/" + questToAdd.QuestObjectives[i].ObjectiveAmount; } quests.Add(questToAdd); entrys.Add(newQuestEntry); }
private bool CheckQuestStatus(I_Quest quest) { for (int i = 0; i < quest.QuestObjectives.Count; i++) { if (!quest.QuestObjectives[i].ObjectiveComplete) { return(false); } } if (quest.HasFollowUpObjective) { quest.SetFollowUpObjective(); quest.HasFollowUpObjective = false; } else { QuestCompleted(quest); } return(true); }
public void RemoveQuest(I_Quest quest) { activeQuestList.Remove(quest); activeQuestListKeys.Remove(quest.QuestID); qlUI.RemoveQuest(quest.QuestID); }
public void AddQuest(I_Quest newQuest) { activeQuestList.Add(newQuest); activeQuestListKeys.Add(newQuest.QuestID); }