Пример #1
0
    void AddItem(ItemPickUp pickUp)
    {
        //check if item is an item that needs to be collected
        if (ItemsToCollect.Contains(pickUp.item))
        {
            //check if the item has already been collected
            if (CurrentItems.Contains(pickUp.item))
            {
                //Item alredy exists and therefor we can return
                EjectItem(pickUp);
                return;
            }

            //Item has not been added and therefor add new item to the collected List
            CurrentItems.Add(pickUp.item);
            //Destroy collected Item
            Destroy(pickUp.gameObject);
        }
        else
        {
            EjectItem(pickUp);
        }

        AllItemsCollected = AreItemsCollected();
    }