コード例 #1
0
    public void OnPickup()
    {
        if (currentPickup != null)
        {
            IItem item = currentPickup.GetItem();
            if (item == null)
            {
                return;
            }

            if (secondaryItem == null)
            {
                OnSwap();
            }
            if (currentItem != null)
            {
                currentItem.Dequipped();
                currentItem.Dropped(transform.position);
            }
            currentItem = item;
            currentItem.Equipped(holder);
        }
        else
        {
            Debug.Log("No pickups to pick");
        }
    }
コード例 #2
0
    public void OnSwap()
    {
        var temp = currentItem;

        currentItem   = secondaryItem;
        secondaryItem = temp;

        secondaryItem?.Dequipped();
        currentItem?.Equipped(holder);
    }