예제 #1
0
        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;
            }
        }
예제 #2
0
 private void completeQuest()
 {
     state = QUEST_STATE.COMPLETE;
     if (questCondition)
     {
         questCondition.isSatisfied = true;
     }
     OnQuestComplete.Invoke(this);
     parentQuestList.invokeQuestGlobalEvent(this, state);
 }
예제 #3
0
        public void failGoal(QuestsList list)
        {
            if (goalState != QUEST_STATE.ACTIVE)
            {
                return;
            }

            goalState = QUEST_STATE.FAILED;
            onGoalFail.Invoke(this);
            list.invokeGoalGlobalEvent(this, goalState);
        }
예제 #4
0
        // 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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        // 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;
            }
        }
예제 #8
0
 private void failQuest()
 {
     state = QUEST_STATE.FAILED;
     OnQuestFailed.Invoke(this);
     parentQuestList.invokeQuestGlobalEvent(this, state);
 }