Example #1
0
        private void ReceiveDelivery(Interactable interactable)
        {
            if (!(interactable is RandomNpc npc))
            {
                return;
            }

            DeliveryNPC delivery = GetDeliveryNpc(npc);

            if (GameManager.Instance.inventory.Has(delivery.foodPlate))
            {
                m_CompletedDeliveries++;
            }
            else
            {
                m_FailedDeliveries++;
            }

            if (m_CompletedDeliveries >= numberOfDeliveries || m_FailedDeliveries >= numberOfDeliveries)
            {
                EndQuest(m_CompletedDeliveries > m_FailedDeliveries ? QuestEndType.DoneGood : QuestEndType.DoneBad);
            }
            else
            {
                SelectRandom();
            }

            delivery.randomNpc.onInteraction -= ReceiveDelivery;
        }
Example #2
0
        private void SelectRandom()
        {
            DeliveryNPC npc = GetRandomDelivery();

            m_CardInstance = GUIManager.Instance.InstantiateUI(npcCardTemplate, false, .8f);
            var card = m_CardInstance.GetComponent <ImageTextCard>();

            card.Set(npc.npcImage, npc.randomNpc.npcName);

            npc.randomNpc.onInteraction += ReceiveDelivery;
        }
Example #3
0
        private DeliveryNPC GetRandomDelivery()
        {
            int         rng = Random.Range(0, randomNpcs.Count);
            DeliveryNPC npc = randomNpcs[rng];

            randomNpcs.RemoveAt(rng);
            m_DeliveringNpcs.Add(npc);

            npc.foodPlate = foodPlates[Random.Range(0, foodPlates.Length)];

            return(npc);
        }