Ejemplo n.º 1
0
    public void Interact()
    {
        if (!isOpen)
        {
            isOpen = true;
            spriteRenderer.sprite = openSprite;
            gameObject.layer      = LayerMask.NameToLayer("Ignore Raycast");

            foreach (Item item in items)
            {
                ItemPickup itemPickup = Instantiate(itemPickupPrefab, transform.position, Quaternion.identity);
                itemPickup.Item = item;
                itemPickup.RandomForceTime();
            }

            items.Clear();
        }
    }