object ISaveable.CaptureState() { var slotStrings = new InventorySlotRecord[inventorySize]; for (int i = 0; i < inventorySize; i++) { if (slots[i].item != null) { slotStrings[i].itemID = slots[i].item.GetItemID(); slotStrings[i].number = slots[i].number; } } return(slotStrings); }
object ISaveable.Save() { var slotStrings = new InventorySlotRecord[_inventorySize]; for (int i = 0; i < _inventorySize; i++) { if (_slots[i].item != null) { Debug.Log("Saving " + _slots[i].item.Name); slotStrings[i].itemID = _slots[i].item.ItemID; slotStrings[i].number = _slots[i].number; } } return(slotStrings); }
public object CaptureState() { //todo var slotStrings = new InventorySlotRecord[inventorySize]; for (var i = 0; i < inventorySize; i++) { if (_slots[i].Item != null) { slotStrings[i].Item = (EquipableItem)_slots[i].Item; slotStrings[i].Number = _slots[i].Number; } } return(slotStrings); }
///////////////////////////// INTERFACES //////////////////////////////////////////// /// <summary> /// Saves the players inventory /// </summary> /// <returns></returns> public object CaptureState() { //Create a string array to hold the IDs from the players inventory var state = new InventorySlotRecord[m_InventorySize]; //Loop through players inventory and store the itemID for each item in the inventory for (int i = 0; i < m_InventorySize; i++) { if (m_slots[i].item != null) { state[i].itemID = m_slots[i].item.GetItemID(); state[i].number = m_slots[i].number; } } return(state); }
object ISaveable.CaptureState() { var slotStrings = new InventorySlotRecord[inventorySize]; for (int i = 0; i < inventorySize; i++) //inventory의 크기만큼 돌면서 slot의 item의 ID와 number를 가져간다. //number는 item { if (slots[i].item != null) { slotStrings[i].itemID = slots[i].item.GetItemID(); slotStrings[i].number = slots[i].number; } } return(slotStrings); }
object ISaveable.CaptureState() { print("Checking inventory to save..."); var slotStrings = new InventorySlotRecord[inventorySize]; for (int i = 0; i < inventorySize; i++) { print("Checking state..."); if (slots[i].item != null) { slotStrings[i].itemID = slots[i].item.GetItemID(); print("Storing state..."); slotStrings[i].number = slots[i].number; } } return(slotStrings); }