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)); } }
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()); } }
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; }