public int objectivesRequired; // a quest can have multipe quests but wont reqire all of them to be finished // for ex quest has 3 objectives, and after completing 2 the quest is finished //Every action player takes updates quests objecties via this method public void UpdateObjective(QuestObjective.Type type, float amount, QuestObjective.Enemy killname, int itemid, QuestObjective.Weapon weaponusedid, string buildingname) { // loops all the quest to check if QuestObjective.Type parameter and one in quest objectives match for (int i = 0; i < objectives.Count; i++) { // if they do it continues if (objectives[i].type == type) { // method in previous ss if (objectives[i].CheckParameters(killname, itemid, weaponusedid, buildingname)) { if (objectives[i].IncreaseObjective(amount)) { objectivesCompleted++; if (objectivesCompleted >= objectivesRequired) { FinishQuest(); } } } } } }
public static void UpdateActiveQuests(QuestObjective.Type type, float amount, QuestObjective.Enemy killname = QuestObjective.Enemy.None, int itemid = -1, QuestObjective.Weapon weaponusedid = QuestObjective.Weapon.None, string buildingname = "") { return; for (int i = 0; i < quests_active.Count; i++) { quests_active[i].UpdateObjective(type, amount, killname, itemid, weaponusedid, buildingname); if (quests_active[i].Finished) { MoveActiveToCompleted(quests_active[i]); } } }