Пример #1
0
    public void CompleteQuest()
    {
        if (selectedQuest.IsComplete)
        {
            for (int i = 0; i < questGiver.MyQuests.Length; i++)
            {
                if (selectedQuest == questGiver.MyQuests[i])
                {
                    questGiver.MyCompletedQuests.Add(selectedQuest.MyTitle);
                    questGiver.MyQuests[i] = null;
                    selectedQuest.MyQuestGiver.UpdateQuestStatus();
                }
            }

            foreach (var objective in selectedQuest.MyCollectObjectives)
            {
                InventoryScript.MyInstance.itemCountChangeEvent -= objective.UpdateItemCount;
                objective.Complete();
            }
            foreach (var objective in selectedQuest.MyKillObjectives)
            {
                GameManager.MyInstance.killConfirmedEvent -= objective.UpdateKillCount;
            }

            var xp = XPManager.CalculateXp(selectedQuest);
            Eeola.MyInstance.GainXp(xp);

            Questlog.MyInstance.RemoveQuest(selectedQuest.MyQuestScript);
            Back();
        }
    }