public void Transfer(int itemId, int itemAmount) { Init(); if (CanTransfer(sourceStorage, itemId, itemAmount)) { sourceStorage.RemoveItemFromStorage(itemId, itemAmount); destinationStorage.AddItemToStorage(itemId, itemAmount); } }
public void Convert(int sourceItemId, int targetItemId) { StorageInventory destinationStorage = characterSwitch.GetCurrentCharacter().GetComponentInChildren <StorageInventory>(); destinationStorage.RemoveItemFromStorage(sourceItemId, 1); destinationStorage.AddItemToStorage(targetItemId, 1); }
public void Exchange(int itemIdForward, int itemAmountForward, int itemIdBackward, int itemAmountBackward) { Init(); if (CanTransfer(sourceStorage, itemIdForward, itemAmountForward) && CanTransfer(destinationStorage, itemIdBackward, itemAmountBackward)) { sourceStorage.RemoveItemFromStorage(itemIdForward, itemAmountForward); destinationStorage.AddItemToStorage(itemIdForward, itemAmountForward); destinationStorage.RemoveItemFromStorage(itemIdBackward, itemAmountBackward); sourceStorage.AddItemToStorage(itemIdBackward, itemAmountBackward); } }
public void Create(int itemId, int itemAmount) { StorageInventory destinationStorage = characterSwitch.GetCurrentCharacter().GetComponentInChildren <StorageInventory>(); destinationStorage.AddItemToStorage(itemId, itemAmount); }