Ejemplo n.º 1
0
    void CheckQuest()
    {
        if (Quest.Completed)
        {
            Quest.GiveReward();
            foreach (Goal g in Quest.Goals)
            {
                if (g.GetType() == typeof(CollectGoal))
                {
                    foreach (CollectGoal goal in Quest.Goals)
                    {
                        for (int i = 0; i < goal.RequiredAmount; i++)
                        {
                            Item item = ItemDatabase.Instance.GetItem(goal.ItemSlug);
                            InventoryController.Instance.playerItems.Remove(item);
                            UIEventHandler.ItemDeletedFromInventory(item);
                        }
                    }
                    break;
                }
            }

            Helped        = true;
            AssignedQuest = false;
            DialogueSystem.Instance.AddNewDialogue(new string[] { "Thanks for the help" }, name);
        }
        else
        {
            DialogueSystem.Instance.AddNewDialogue(new string[] { "Do the job or no reward!!!" }, name);
        }
    }