IEnumerator UpdateJournal() { float t = 0; while (t < 1) { t += 0.05f; rt.position = Vector3.Lerp(posStart, posStart + offscreenOffset, t); yield return(new WaitForSeconds(0.03f)); } var quests = ActiveQuests.GetActiveQuests(); text.text = ""; foreach (var quest in quests.Values) { if (quest.parentQuest == null || !quest.parentQuest.isComplete) { Display(quest); } } while (t > 0) { t -= 0.05f; rt.position = Vector3.Lerp(posStart, posStart + offscreenOffset, t); yield return(new WaitForSeconds(0.03f)); } }
public void MarkQuestsAsComplete(string[] completedQuests, int completeCount) { for (int i = 0; i < completeCount; i++) { ActiveQuests.MarkQuestAsComplete(completedQuests[i]); } }
void Start() { // Get the ActiveQuestPanel gameobject that is there at start so we can gather position from it startingActiveQuestPanel = transform.Find("ScrollRectImage/QuestListCanvas/ActiveQuestPanel").gameObject; startingItemReward = transform.Find("QuestDescription/ItemRewardBG/ItemRewardCanvas/ItemRewardSprite").gameObject; origQuestPanelPos = startingActiveQuestPanel.transform.position; origItemRewardPos = startingItemReward.transform.position; questListCanvas = startingActiveQuestPanel.transform.parent.gameObject; itemRewardCanvas = startingItemReward.transform.parent.gameObject; originalPanelName = activeQuestPanelPrefab.name; // After we get all the data needed from The quest panel we destroy it to clear out active quest panel list in the GUI // otherwise we will always have one panel there at start of the scene Destroy(startingActiveQuestPanel); Destroy(startingItemReward); dataToPass = GameObject.FindGameObjectWithTag("PassData").GetComponent <DataToPassBetweenScenes>(); activeQuests = dataToPass.ActiveQuests; // Long way to reset the gold amount when opening questscreen questDescriptionText = transform.Find("QuestDescription").gameObject.GetComponent <TextMeshProUGUI>(); goldRewardText = transform.Find("QuestDescription/MoneyRewardBG/MoneyRewardCanvas/AmountOfMoneyText").GetComponent <TextMeshProUGUI>(); goldRewardText.text = ""; Close(); }
IEnumerator endChaseFade() { float a = 0; while (a < 1) { a += 0.01f; fadeToBlack.color = new Color(0, 0, 0, a); yield return(new WaitForSeconds(0.01f)); } thief.SetActive(false); car.Exit(); ActiveQuests.MarkQuestAsComplete("CatchThief"); documentStoreWorker.StartDialogue(); yield return(new WaitForSeconds(1.3f)); while (a > 0) { a -= 0.01f; fadeToBlack.color = new Color(0, 0, 0, a); yield return(new WaitForSeconds(0.01f)); } }
private void Start() { rt = GetComponent <RectTransform>(); posStart = rt.position; // DEBUG STARTING QUEST ActiveQuests.AddQuest(debugStartQuest.name, debugStartQuest); }
public void LoadQuests(string[] questsAcquired, int questCount) { for (int i = 0; i < questCount; i++) { Quest questToAdd; quests.TryGetValue(questsAcquired[i], out questToAdd); ActiveQuests.AddQuest(questToAdd.name, questToAdd); } }
public static void AddActiveQuest(string questName) { if (ActiveQuests.Contains(questName)) { Debug.Log("Quest name has to be unique"); return; } ActiveQuests.Add(questName); }
private bool CheckCompletedQuests(DialogueData dialogue) { bool areQuestsComplete = true; foreach (Quest quest in dialogue.questsCompleted) { areQuestsComplete &= ActiveQuests.IsQuestComplete(quest.name); } return(areQuestsComplete); }
private bool CheckRequiredQuests(DialogueData dialogue) { bool hasQuest = true; foreach (Quest quest in dialogue.questsRequired) { hasQuest &= ActiveQuests.HasQuest(quest.name); } return(hasQuest); }
private void QuestComplete() { // The quest is no longer active ActiveQuests.Remove(Q.gameObject); // The Character is no longer on the quest m_GameManager.GuildScript.MembersOnQuest.Remove(C); // Finish the Quest Q.Finished(); CheckSuccess(); }
/// <summary>Called when a quest's active state has changed to add it to or remove it from the activeQuests list</summary> private void OnActiveStateChanged(Quest quest, bool value) { if (value) { ActiveQuests.Add(quest); MainCanvasManager.Instance.AddNotification(GameNotificationType.Quest); } else { ActiveQuests.Remove(quest); } }
/// <summary> /// Initializes a new instance of the <see cref="QuestPerformerStatusHelper"/> class. /// </summary> /// <param name="owner">The quest performer that this object will track the quest status of.</param> public QuestPerformerStatusHelper(User owner) : base(owner) { _questKillCounter = new QuestPerformerKillCounter(owner); // Send the initial quest status var completed = CompletedQuests.Select(x => x.QuestID); var active = ActiveQuests.Select(x => x.QuestID); using (var pw = ServerPacket.QuestInfo(x => UserQuestInformation.WriteQuestInfo(x, completed, active))) { Owner.Send(pw, ServerMessageType.GUI); } }
public void FinishQuest(string name) { if (!IsQuestActive(name)) { return; } var quest = Manager.GameData.Quests[Manager.GameData.IdToQuestType[name]]; ActiveQuests.Remove(GetActiveQuest(name)); FinishedQuests.Add(CreatePQuest(quest)); client.SendPacket(new NotificationPacket { Color = new ARGB(0x0094FF), ObjectId = Id, Text = "Quest Finished: " + name }); }
private void UpdateQuests(DialogueData dialogue) { foreach (Quest quest in dialogue.questsToAdd) { if (!ActiveQuests.HasQuest(quest.name)) { ActiveQuests.AddQuest(quest.name, quest); } } foreach (Quest quest in dialogue.questsToComplete) { if (ActiveQuests.HasQuest(quest.name)) { ActiveQuests.MarkQuestAsComplete(quest.name); } } }
public static void DeactivateQuest(Quest quest) { if (!quest.IsActive) { return; } if (!ActiveQuests.Contains(quest)) { return; } ActiveQuests.Remove(quest); OnQuestDeactivate?.Invoke(quest); quest.ResetAllProgress(); // set to not active. quest.IsActive = false; }
/// <summary> /// Serialize the quest diary. /// </summary> /// <param name="packet">Packet stream.</param> public void Serialize(INetPacketStream packet) { packet.Write((byte)ActiveQuests.Count()); foreach (QuestInfo quest in ActiveQuests) { quest.Serialize(packet); } packet.Write((byte)CompletedQuests.Count()); foreach (QuestInfo quest in CompletedQuests) { packet.Write((short)quest.QuestId); } packet.Write((byte)CheckedQuests.Count()); foreach (QuestInfo quest in CheckedQuests) { packet.Write((short)quest.QuestId); } }
public static bool ActivateQuest(Quest quest) { if (quest.IsActive) { return(false); } if (ActiveQuests.Count >= MAX_QUESTS_ACTIVE) { // cannot activate quest. return(false); } // set to active. quest.IsActive = true; ActiveQuests.Add(quest); OnQuestActivate?.Invoke(quest); return(true); }
void Update() { var quests = ActiveQuests.GetActiveQuests(); int completed = 0; foreach (var quest in quests.Values) { if (quest.isComplete) { completed++; } } if (numCompleted != completed || numQuests != quests.Count) { numCompleted = completed; numQuests = quests.Count; StartCoroutine(UpdateJournal()); } }
private void Start() { foreach (Quest quest in questAsset.Quests) { quest.LoadActiveStateFromFile(); quest.LoadTasksFromFile(); quest.ActiveStateChanged += OnActiveStateChanged; quest.Completed += OnQuestCompleted; } #if UNITY_EDITOR //quest state is saved in editor so add active quests manually if in editor foreach (Quest quest in questAsset.Quests) { if (quest.IsActive && !ActiveQuests.Contains(quest)) { ActiveQuests.Add(quest); } } #endif }
public SaveData(Vector3 playerPosition) { // saving position position = new float[3]; position[0] = playerPosition.x; position[1] = playerPosition.y; position[2] = playerPosition.z; // saving player items itemCount = Inventory.GetCurrentItems().Count; playerItems = new string[itemCount]; int item_index = 0; foreach (KeyValuePair <string, Item> item_pair in Inventory.GetCurrentItems()) { playerItems[item_index] = item_pair.Key; item_index++; } // saving player quests acquired and quests complete questCount = ActiveQuests.GetActiveQuests().Count; playerAcquiredQuests = new string[questCount]; playerCompletedQuests = new string[questCount]; int quest_index = 0; int quest_complete_index = 0; foreach (KeyValuePair <string, Quest> quest_pair in ActiveQuests.GetActiveQuests()) { if (quest_pair.Value.isComplete) { playerCompletedQuests[quest_complete_index] = quest_pair.Key; quest_complete_index++; } playerAcquiredQuests[quest_index] = quest_pair.Key; quest_index++; } questCompleteCount = quest_complete_index; }
public void AddQuestToActiveQuests() { ActiveQuests.AddQuest(name, this); }
public static void QuestCompleted(string questName) { ActiveQuests.Remove(questName); CompletedQuests.Add(questName); }
public bool IsObjectiveActive(string name, int id) { return(ActiveQuests.Where(_ => (_.Quest.QuestId.EqualsIgnoreCase(name) && (_.Objectives.Where(o => o.Id == id && !o.Completed).Count() > 0))).Count() > 0); }
/// <summary> /// Gets the active quest based on the given id. /// </summary> /// <param name="questId">Quest id.</param> /// <returns><see cref="QuestInfo"/>.</returns> public QuestInfo GetActiveQuest(int questId) => ActiveQuests.FirstOrDefault(x => x.QuestId == questId);
public void RemoveItemFromInventory() { ActiveQuests.RemoveQuest(name); }
public bool IsQuestActive(string name) { return(ActiveQuests.Where(_ => _.Quest.QuestId.EqualsIgnoreCase(name)).Count() > 0); }