void uSlots() { Vector2Int[] slots = inv.GetSlots(); for (int i = 0; i < slots.Length; i++) { SetItem(slots[i], slotsContainer.GetChild(i)); } }
public void save() { int parent = -1; if (player.transform != null) { parent = saveOtherStuff.transforms.IndexOf(player.transform.parent); } SaveDataPlayer sDP = new SaveDataPlayer(inventory.GetSlots(), inventory.GetTools(), inventory.GetActives(), player.position, player.velocity, player.rotation, parent, inventory.money); SaveSystem.SavePlayer(sDP, saveCom.saveName); }
void loadInventory() { Vector2Int[] invSlots = inv.GetSlots(); foreach (Transform child in productPanel) { Destroy(child.gameObject); } for (int i = 0; i < invSlots.Length; i++) { GameObject g = GameObject.Instantiate(prefab, Vector2.zero, Quaternion.identity, productPanel); shopProduct sP = g.GetComponent <shopProduct>(); sP.slot = i; sP.setVariables(items.instance.itemObjects[invSlots[i].x], false, invSlots[i].y); } }