예제 #1
0
 public void AddNewObjective(Objective_Base referenceObjective)
 {
     activeObjectives.Add(referenceObjective);
     questCompletionStates[referenceObjective.QuestEnumeration] = 1;
     UpdateObjectiveInterface();
     SaveQuestLog();
 }
예제 #2
0
    private void Update()
    {
        if (!questsLoaded)
        {
            foreach (UnityEngine.Object obj in Resources.LoadAll <UnityEngine.Object>("ObjectiveQuests"))
            {
                Objective_Base temp = (ScriptableObject.CreateInstance(obj.name) as Objective_Base);

                //Quest In Progress
                if (questCompletionStates.ContainsKey(temp.QuestEnumeration) && questCompletionStates[temp.QuestEnumeration] == 1)
                {
                    temp.QuestStage = questProgressStates[temp.QuestEnumeration];
                    AddNewObjective(temp);
                }

                //Quest Not Started
                else if (!questCompletionStates.ContainsKey(temp.QuestEnumeration))
                {
                    questProgressStates.Add(temp.QuestEnumeration, 0);
                    questCompletionStates.Add(temp.QuestEnumeration, 0);
                }

                //Quest Completed
                else if (questCompletionStates.ContainsKey(temp.QuestEnumeration) && questCompletionStates[temp.QuestEnumeration] == 2)
                {
                    Destroy(temp);
                    temp = null;
                }
            }
            questsLoaded = true;
        }
    }
예제 #3
0
    public void LoadQuestLog()
    {
        BinaryFormatter bf    = new BinaryFormatter();
        FileStream      ifs   = new FileStream("QuestLog.dat", FileMode.Open);
        QuestLog        myLog = (QuestLog)bf.Deserialize(ifs);

        questCompletionStates = myLog.questCompletionStates;
        questProgressStates   = myLog.questProgressState;
        ifs.Close();

        if (!questsLoaded)
        {
            foreach (UnityEngine.Object obj in Resources.LoadAll <UnityEngine.Object>("ObjectiveQuests"))
            {
                Objective_Base temp = (ScriptableObject.CreateInstance(obj.name) as Objective_Base);

                //Quest In Progress
                if (questCompletionStates.ContainsKey(temp.QuestEnumeration) && questCompletionStates[temp.QuestEnumeration] == 1)
                {
                    temp.QuestStage = questProgressStates[temp.QuestEnumeration];
                    AddNewObjective(temp);
                }

                //Quest Not Started
                else if (!questCompletionStates.ContainsKey(temp.QuestEnumeration))
                {
                    questProgressStates.Add(temp.QuestEnumeration, 0);
                    questCompletionStates.Add(temp.QuestEnumeration, 0);
                }

                //Quest Completed
                else if (questCompletionStates.ContainsKey(temp.QuestEnumeration) && questCompletionStates[temp.QuestEnumeration] == 2)
                {
                    Destroy(temp);
                    temp = null;
                }
            }
            questsLoaded = true;
        }
    }
예제 #4
0
 public void PlayProgressAnimation(Objective_Base referenceObjective)
 {
     transform.Find(referenceObjective.ObjectiveName).GetComponent <Animator>().Play("ProgressAnim");
 }
예제 #5
0
 public void RemoveObjective(Objective_Base referenceObjective)
 {
     transform.Find(referenceObjective.ObjectiveName).GetComponent <Animator>().Play("CompletedAnim");
     activeObjectives.Remove(referenceObjective);
     Destroy(referenceObjective);
 }