public void OnPickUp(ActiveItem activeItem, Transform transform) { if (carriedItems.Count == maximumCarriedItems) { carriedItems.Remove(chosenActiveItem); var pickableItem = Instantiate(pickableItemPrefab, transform.position, transform.rotation).GetComponent <IPickable>(); pickableItem.Initialize(chosenActiveItem.ItemBaseKey); chosenActiveItem = activeItem; carriedItems.Add(activeItem); activeItem.OnPickUp(); activeItemPickedUp.Raise(); return; } carriedItems.Add(activeItem); chosenActiveItem = carriedItems[0]; activeItem.OnPickUp(); activeItemPickedUp.Raise(); }
public void Initialize() { carriedItems = new List <ActiveItem>(); chosenActiveItem = null; maximumCarriedItems = 1; }