コード例 #1
0
 public void CompleteQuest(QuestID questID)
 {
     if (!QuestData.IsCompleted(questID))
     {
         QuestChapter currentQuestChapter = IsValidQuestChapterIndex(CurrentQuestChapterIndex) ? QuestBook.QuestChapters[CurrentQuestChapterIndex] : null;
         if (currentQuestChapter != null && currentQuestChapter.Contains(questID))
         {
             QuestData.CompleteQuest(questID);
             if (QuestBook.QuestChapters[CurrentQuestChapterIndex].Quests.All((quest) => QuestData.IsCompleted(quest.ID)))
             {
                 CurrentQuestChapterIndex++;
             }
         }
     }
 }
コード例 #2
0
 void LoadQuestData()
 {
     if (File.Exists(QuestDataPath))
     {
         var bytes = File.ReadAllBytes(QuestDataPath);
         QuestData = SerializationUtility.DeserializeValue <QuestData>(bytes, DataFormat);
         if (QuestData == null)
         {
             ResetQuestData();
         }
         else
         {
             CurrentQuestChapterIndex = 0;
             while (IsValidQuestChapterIndex(CurrentQuestChapterIndex) &&
                    QuestBook.QuestChapters[CurrentQuestChapterIndex].Quests.All((quest) => QuestData.IsCompleted(quest.ID)))
             {
                 CurrentQuestChapterIndex++;
             }
         }
     }
     else
     {
         ResetQuestData();
     }
 }
コード例 #3
0
 void ResetQuestData()
 {
     QuestData = new QuestData();
     CurrentQuestChapterIndex = 0;
 }