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"); } }
public void OnSwap() { var temp = currentItem; currentItem = secondaryItem; secondaryItem = temp; secondaryItem?.Dequipped(); currentItem?.Equipped(holder); }