public void invokeQuestGlobalEvent(Quest quest, QUEST_STATE state) { switch (state) { case QUEST_STATE.ACTIVE: if (OnQuestActive != null) { OnQuestActive(quest); } break; case QUEST_STATE.FAILED: if (OnQuestFailed != null) { OnQuestFailed(quest); } break; case QUEST_STATE.COMPLETE: if (OnQuestComplete != null) { OnQuestComplete(quest); } break; } }
private void completeQuest() { state = QUEST_STATE.COMPLETE; if (questCondition) { questCondition.isSatisfied = true; } OnQuestComplete.Invoke(this); parentQuestList.invokeQuestGlobalEvent(this, state); }
public void failGoal(QuestsList list) { if (goalState != QUEST_STATE.ACTIVE) { return; } goalState = QUEST_STATE.FAILED; onGoalFail.Invoke(this); list.invokeGoalGlobalEvent(this, goalState); }
// This is the entry point called from QuestReactions in order to activate a quest. public void activeQuest() { state = QUEST_STATE.ACTIVE; for (int i = 0; i < questGoals.Length; i++) { questGoals[i].goalState = QUEST_STATE.ACTIVE; } OnQuestActive.Invoke(this); parentQuestList.invokeQuestGlobalEvent(this, state); }
public void completeGoal(QuestsList list) { if (goalState != QUEST_STATE.ACTIVE) { return; } goalState = QUEST_STATE.COMPLETE; if (goalCondition) { goalCondition.isSatisfied = true; } onGoalComplete.Invoke(this); list.invokeGoalGlobalEvent(this, goalState); }
public void invokeGoalGlobalEvent(Goal goal, QUEST_STATE state) { switch (state) { case QUEST_STATE.FAILED: if (onGoalFail != null) { onGoalFail(goal); } break; case QUEST_STATE.COMPLETE: if (onGoalComplete != null) { onGoalComplete(goal); } break; } }
// Reset all variables and goals at game stop public override void Reset() { if (questCondition) { questCondition.isSatisfied = false; } state = QUEST_STATE.INACTIVE; for (int i = 0; i < questGoals.Length; i++) { if (questGoals[i].goalCondition) { questGoals[i].goalCondition.isSatisfied = false; } questGoals[i].goalState = QUEST_STATE.INACTIVE; } }
private void failQuest() { state = QUEST_STATE.FAILED; OnQuestFailed.Invoke(this); parentQuestList.invokeQuestGlobalEvent(this, state); }