How did the items get into inventory?

How did the items get into inventory?

Struggling here?

thanks for any insight

We start in CompleteObjective

        public void CompleteObjective(Quest quest, string objective)
        {
            QuestStatus status = GetQuestStatus(quest);
            status.CompleteObjective(objective);
            if (status.IsComplete())
            {
                GiveReward(quest);
            }
            if (onUpdate != null)
            {
                onUpdate();
            }
        }

GiveReward(quest); is the next link in the chain

        private void GiveReward(Quest quest)
        {
            foreach (var reward in quest.GetRewards())
            {
                bool success = GetComponent<Inventory>().AddToFirstEmptySlot(reward.item, reward.number);
                if (!success)
                {
                    GetComponent<ItemDropper>().DropItem(reward.item, reward.number);
                }
            }
        }

First, GiveReward tries to put the item in inventory using Inventory.AddToFirstEmptySlot(). If that’s not successful, then the item is dropped on the ground.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms