public void SpawnItems(ItemType[] allowedItems, int requiredGuests, int numberOfItemsMod, float maxItemSize)
    {
        foreach (LostAndFoundItem item in currentItems)
        {
            itemPool.Enqueue(item);
        }

        currentItems.Clear();
        numberOfExistingItems = requiredGuests * numberOfItemsMod;
        for (int i = 0; i < numberOfExistingItems; i++)
        {
            LostAndFoundItem item    = GrabItem();
            ItemData         newData = new ItemData();
            newData.paletteInfo          = allPalettes[Random.Range(0, allPalettes.Length)];
            newData.type                 = allowedItems[Random.Range(0, allowedItems.Length)];//(ItemType) Random.Range(0,Enum.GetNames(typeof(ItemType)).Length);
            newData.itemSprite           = itemSprites[(int)newData.type];
            item.transform.localPosition = new Vector2(
                Random.Range(rect.rect.xMin, rect.rect.xMax),
                Random.Range(rect.rect.yMin, rect.rect.yMax)
                );
            item.transform.localScale = Vector3.zero;//Vector3.one * Random.Range(0.8f, 1.2f);
            item.transform.DOScale(Vector3.one * Random.Range(0.5f, maxItemSize), 0.25f).SetDelay(0.01f * i);
            item.transform.localEulerAngles = Vector3.forward * Random.Range(-maxRotDelta, maxRotDelta);
            item.ApplyItemData(newData);
            item.gameObject.SetActive(true);
        }
    }
    public LostAndFoundItem GrabItem()
    {
        LostAndFoundItem item = itemPool.Dequeue();

        currentItems.Add(item);
        return(item);
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     rect     = GetComponent <RectTransform>();
     itemPool = new Queue <LostAndFoundItem>();
     for (int i = 0; i < poolSize; i++)
     {
         LostAndFoundItem newItem = Instantiate(lostAndFoundFab).GetComponent <LostAndFoundItem>();
         newItem.lostAndFoundParent = rect;
         newItem.transform.SetParent(gameObject.transform);
         newItem.gameObject.SetActive(false);
         itemPool.Enqueue(newItem);
     }
 }
 public void RemoveItem(LostAndFoundItem item)
 {
     item.gameObject.SetActive(false);
     itemPool.Enqueue(item);
     currentItems.Remove(item);
 }