public void EquipItem(EquipableItem equippableItem) { foreach(RoverComponent rc in CachedPlayerStats.roverComponents) { if(rc.currentComponentType == equippableItem.componentType) { //equipment match, swap it out!! rc.equippedItem = equippableItem; return; } } //we dont already have this item. add it. RoverComponent roverComponent = new RoverComponent(); roverComponent.currentComponentType = equippableItem.componentType; roverComponent.equippedItem = equippableItem; Initialize(); }
public void EquipItem(EquipableItem equippableItem) { foreach (RoverComponent rc in CachedPlayerStats.roverComponents) { if (rc.currentComponentType == equippableItem.componentType) { //equipment match, swap it out!! rc.equippedItem = equippableItem; return; } } //we dont already have this item. add it. RoverComponent roverComponent = new RoverComponent(); roverComponent.currentComponentType = equippableItem.componentType; roverComponent.equippedItem = equippableItem; Initialize(); }
private void Initialize(bool b) { Inventory inventory = UIManager.GetMenu <Inventory>(); if (UIManager.GetMenu <Inventory>().ContainerExchange) { if (b) { Container container = UIManager.GetMenu <Container>(); //need to handle transfer if (amount > 5) { } else { //just throw one over container.AddInventoryItem(SlotIngredient, 1); inventory.RemoveInventoryItem(SlotIngredient, 1); } } } else { //not exchanging!! if (slotIngredient as EquipableItem) { if (GetComponent <DragHandler>().dragLength < 0.1f) { //they just clicked Debug.Log("equipping"); EquipableItem ei = (EquipableItem)slotIngredient; inventory.RemoveInventoryItem(slotIngredient, 1); inventory.equipmentPanel.EquipItem(ei); inventory.InitializeInventorySlots(); inventory.equipmentPanel.Initialize(); } else { //they dragged and we need to handle this differently Debug.Log("drag equipping"); EquipableItem ei = (EquipableItem)slotIngredient; inventory.RemoveInventoryItem(slotIngredient, 1); inventory.equipmentPanel.EquipItem(ei); inventory.InitializeInventorySlots(); inventory.equipmentPanel.Initialize(); } } else { //???? } } CloseHoverTooltip(); }